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 /source/blender/makesdna | |
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 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_layer_types.h | 19 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_world_types.h | 4 |
3 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index 7b6fe3773f8..d5f7e25bb80 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -124,6 +124,21 @@ typedef struct ViewLayerAOV { * matches `eViewLayerAOVType` */ int type; } ViewLayerAOV; + +/* Lightgroup Renderpass definition. */ +typedef struct ViewLayerLightgroup { + struct ViewLayerLightgroup *next, *prev; + + /* Name of the Lightgroup */ + char name[64]; +} ViewLayerLightgroup; + +/* Lightgroup membership information. */ +typedef struct LightgroupMembership { + /* Name of the Lightgroup */ + char name[64]; +} LightgroupMembership; + typedef struct ViewLayer { struct ViewLayer *next, *prev; /** MAX_NAME. */ @@ -164,6 +179,10 @@ typedef struct ViewLayer { ListBase aovs; ViewLayerAOV *active_aov; + /* List containing the 'ViewLayerLightgroup`s */ + ListBase lightgroups; + ViewLayerLightgroup *active_lightgroup; + /* Runtime data */ /** ViewLayerEngineData. */ ListBase drawdata; diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 30f80110f6e..54627e711ff 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -31,6 +31,7 @@ struct Curve; struct FluidsimSettings; struct GeometrySet; struct Ipo; +struct LightgroupMembership; struct Material; struct Mesh; struct Object; @@ -434,8 +435,10 @@ typedef struct Object { ObjectLineArt lineart; + /** Lightgroup membership information. */ + struct LightgroupMembership *lightgroup; + /** Runtime evaluation data (keep last). */ - void *_pad9; Object_Runtime runtime; } Object; diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 497b99eb04d..88f2e0c9407 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -16,6 +16,7 @@ extern "C" { struct AnimData; struct Ipo; +struct LightgroupMembership; struct bNodeTree; #ifndef MAX_MTEX @@ -70,6 +71,9 @@ typedef struct World { /* nodes */ struct bNodeTree *nodetree; + /* Lightgroup membership information. */ + struct LightgroupMembership *lightgroup; + /** Runtime. */ ListBase gpumaterial; } World; |