diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2022-04-02 01:11:11 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2022-04-02 07:14:27 +0300 |
commit | ad35453cd19b3db779b0b3a90feac2e93c7a73cf (patch) | |
tree | 3ad7893815bda3e34e18302422ad1f978e828603 /intern/cycles/integrator | |
parent | 5387d33e5f954c4cecdb7ffd3d1042d8632d6c15 (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/integrator')
-rw-r--r-- | intern/cycles/integrator/pass_accessor.cpp | 17 | ||||
-rw-r--r-- | intern/cycles/integrator/pass_accessor.h | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp index 0be3cf6860b..05318b7545b 100644 --- a/intern/cycles/integrator/pass_accessor.cpp +++ b/intern/cycles/integrator/pass_accessor.cpp @@ -18,7 +18,11 @@ CCL_NAMESPACE_BEGIN */ PassAccessor::PassAccessInfo::PassAccessInfo(const BufferPass &pass) - : type(pass.type), mode(pass.mode), include_albedo(pass.include_albedo), offset(pass.offset) + : type(pass.type), + mode(pass.mode), + include_albedo(pass.include_albedo), + is_lightgroup(!pass.lightgroup.empty()), + offset(pass.offset) { } @@ -127,7 +131,8 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers, const PassType type = pass_access_info_.type; const PassMode mode = pass_access_info_.mode; - const PassInfo pass_info = Pass::get_info(type, pass_access_info_.include_albedo); + const PassInfo pass_info = Pass::get_info( + type, pass_access_info_.include_albedo, pass_access_info_.is_lightgroup); int num_written_components = pass_info.num_components; if (pass_info.num_components == 1) { @@ -215,8 +220,8 @@ void PassAccessor::init_kernel_film_convert(KernelFilmConvert *kfilm_convert, const Destination &destination) const { const PassMode mode = pass_access_info_.mode; - const PassInfo &pass_info = Pass::get_info(pass_access_info_.type, - pass_access_info_.include_albedo); + const PassInfo &pass_info = Pass::get_info( + pass_access_info_.type, pass_access_info_.include_albedo, pass_access_info_.is_lightgroup); kfilm_convert->pass_offset = pass_access_info_.offset; kfilm_convert->pass_stride = buffer_params.pass_stride; @@ -279,8 +284,8 @@ bool PassAccessor::set_render_tile_pixels(RenderBuffers *render_buffers, const S return false; } - const PassInfo pass_info = Pass::get_info(pass_access_info_.type, - pass_access_info_.include_albedo); + const PassInfo pass_info = Pass::get_info( + pass_access_info_.type, pass_access_info_.include_albedo, pass_access_info_.is_lightgroup); const BufferParams &buffer_params = render_buffers->params; diff --git a/intern/cycles/integrator/pass_accessor.h b/intern/cycles/integrator/pass_accessor.h index 7de1d03961b..683d3a35272 100644 --- a/intern/cycles/integrator/pass_accessor.h +++ b/intern/cycles/integrator/pass_accessor.h @@ -28,6 +28,7 @@ class PassAccessor { PassType type = PASS_NONE; PassMode mode = PassMode::NOISY; bool include_albedo = false; + bool is_lightgroup = false; int offset = -1; /* For the shadow catcher matte pass: whether to approximate shadow catcher pass into its |