From ad35453cd19b3db779b0b3a90feac2e93c7a73cf Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Sat, 2 Apr 2022 00:11:11 +0200 Subject: 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 --- intern/cycles/kernel/types.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'intern/cycles/kernel/types.h') diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h index 00b5b007e11..9d9daaa0dda 100644 --- a/intern/cycles/kernel/types.h +++ b/intern/cycles/kernel/types.h @@ -46,6 +46,7 @@ CCL_NAMESPACE_BEGIN #define LAMP_NONE (~0) #define ID_NONE (0.0f) #define PASS_UNUSED (~0) +#define LIGHTGROUP_NONE (~0) #define INTEGRATOR_SHADOW_ISECT_SIZE_CPU 1024U #define INTEGRATOR_SHADOW_ISECT_SIZE_GPU 4U @@ -1108,6 +1109,7 @@ typedef struct KernelFilm { int pass_aov_color; int pass_aov_value; + int pass_lightgroup; /* XYZ to rendering color space transform. float4 instead of float3 to * ensure consistent padding/alignment across devices. */ @@ -1192,8 +1194,10 @@ typedef struct KernelBackground { int use_mis; + int lightgroup; + /* Padding */ - int pad1, pad2, pad3; + int pad1, pad2; } KernelBackground; static_assert_align(KernelBackground, 16); @@ -1372,9 +1376,12 @@ typedef struct KernelObject { float ao_distance; + int lightgroup; + uint visibility; int primitive_type; - int pad[2]; + + int pad1; } KernelObject; static_assert_align(KernelObject, 16); @@ -1427,7 +1434,7 @@ typedef struct KernelLight { float random; float strength[3]; int use_caustics; - float pad1; + int lightgroup; Transform tfm; Transform itfm; union { -- cgit v1.2.3