Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2022-04-02 01:11:11 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2022-04-02 07:14:27 +0300
commitad35453cd19b3db779b0b3a90feac2e93c7a73cf (patch)
tree3ad7893815bda3e34e18302422ad1f978e828603 /intern/cycles/scene/pass.cpp
parent5387d33e5f954c4cecdb7ffd3d1042d8632d6c15 (diff)
Cycles: Add support for light groups
Light groups are a type of pass that only contains lighting from a subset of light sources. They are created in the View layer, and light sources (lamps, objects with emissive materials and/or the environment) can be assigned to a group. Currently, each light group ends up generating its own version of the Combined pass. In the future, additional types of passes (e.g. shadowcatcher) might be getting their own per-lightgroup versions. The lightgroup creation and assignment is not Cycles-specific, so Eevee or external render engines could make use of it in the future. Note that Lightgroups are identified by their name - therefore, the name of the Lightgroup in the View Layer and the name that's set in an object's settings must match for it to be included. Currently, changing a Lightgroup's name does not update objects - this is planned for the future, along with other features such as denoising for light groups and viewing them in preview renders. Original patch by Alex Fuller (@mistaed), with some polishing by Lukas Stockner (@lukasstockner97). Differential Revision: https://developer.blender.org/D12871
Diffstat (limited to 'intern/cycles/scene/pass.cpp')
-rw-r--r--intern/cycles/scene/pass.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/intern/cycles/scene/pass.cpp b/intern/cycles/scene/pass.cpp
index 41730cb189d..5f5b19e710d 100644
--- a/intern/cycles/scene/pass.cpp
+++ b/intern/cycles/scene/pass.cpp
@@ -124,6 +124,7 @@ NODE_DEFINE(Pass)
SOCKET_ENUM(mode, "Mode", *pass_mode_enum, static_cast<int>(PassMode::DENOISED));
SOCKET_STRING(name, "Name", ustring());
SOCKET_BOOLEAN(include_albedo, "Include Albedo", false);
+ SOCKET_STRING(lightgroup, "Light Group", ustring());
return type;
}
@@ -134,7 +135,7 @@ Pass::Pass() : Node(get_node_type()), is_auto_(false)
PassInfo Pass::get_info() const
{
- return get_info(type, include_albedo);
+ return get_info(type, include_albedo, !lightgroup.empty());
}
bool Pass::is_written() const
@@ -142,7 +143,7 @@ bool Pass::is_written() const
return get_info().is_written;
}
-PassInfo Pass::get_info(const PassType type, const bool include_albedo)
+PassInfo Pass::get_info(const PassType type, const bool include_albedo, const bool is_lightgroup)
{
PassInfo pass_info;
@@ -157,9 +158,9 @@ PassInfo Pass::get_info(const PassType type, const bool include_albedo)
pass_info.num_components = 0;
break;
case PASS_COMBINED:
- pass_info.num_components = 4;
+ pass_info.num_components = is_lightgroup ? 3 : 4;
pass_info.use_exposure = true;
- pass_info.support_denoise = true;
+ pass_info.support_denoise = !is_lightgroup;
break;
case PASS_DEPTH:
pass_info.num_components = 1;
@@ -369,13 +370,16 @@ const Pass *Pass::find(const vector<Pass *> &passes, const string &name)
return nullptr;
}
-const Pass *Pass::find(const vector<Pass *> &passes, PassType type, PassMode mode)
+const Pass *Pass::find(const vector<Pass *> &passes,
+ PassType type,
+ PassMode mode,
+ const ustring &lightgroup)
{
for (const Pass *pass : passes) {
- if (pass->get_type() != type || pass->get_mode() != mode) {
+ if (pass->get_type() != type || pass->get_mode() != mode ||
+ pass->get_lightgroup() != lightgroup) {
continue;
}
-
return pass;
}