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/blender/addon | |
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/blender/addon')
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 4 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 31 |
2 files changed, 34 insertions, 1 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 48dd26cc622..b7713dc7110 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -228,6 +228,10 @@ def list_render_passes(scene, srl): else: yield (aov.name, "RGB", 'COLOR') + # Light groups. + for lightgroup in srl.lightgroups: + yield ("Combined_%s" % lightgroup.name, "RGB", 'COLOR') + def register_passes(engine, scene, view_layer): for name, channelids, channeltype in list_render_passes(scene, view_layer): diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c86452e0a18..621a5571f63 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -12,7 +12,7 @@ from bpy.types import Panel from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel from bl_ui.properties_render import draw_hair_settings -from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel +from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel, ViewLayerLightgroupsPanel class CyclesPresetPanel(PresetPanel, Panel): COMPAT_ENGINES = {'CYCLES'} @@ -883,6 +883,12 @@ class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, ViewLayerAOVPanel): bl_parent_id = "CYCLES_RENDER_PT_passes" +class CYCLES_RENDER_PT_passes_lightgroups(CyclesButtonsPanel, ViewLayerLightgroupsPanel): + bl_label = "Light Groups" + bl_context = "view_layer" + bl_parent_id = "CYCLES_RENDER_PT_passes" + + class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel): bl_label = "Post Processing" bl_options = {'DEFAULT_CLOSED'} @@ -1147,6 +1153,23 @@ class CYCLES_OBJECT_PT_shading_caustics(CyclesButtonsPanel, Panel): col.prop(cob, "is_caustics_receiver") +class CYCLES_OBJECT_PT_lightgroup(CyclesButtonsPanel, Panel): + bl_label = "Light Group" + bl_parent_id = "CYCLES_OBJECT_PT_shading" + bl_context = "object" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + ob = context.object + + view_layer = context.view_layer + + col = layout.column(align=True) + col.prop_search(ob, "lightgroup", view_layer, "lightgroups", text="Light Group") + + class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel): bl_label = "Visibility" bl_context = "object" @@ -1399,10 +1422,14 @@ class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel): layout.use_property_split = True world = context.world + view_layer = context.view_layer if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'): layout.prop(world, "color") + col = layout.column(align=True) + col.prop_search(world, "lightgroup", view_layer, "lightgroups", text="Light Group") + class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" @@ -2209,6 +2236,7 @@ classes = ( CYCLES_RENDER_PT_passes_light, CYCLES_RENDER_PT_passes_crypto, CYCLES_RENDER_PT_passes_aov, + CYCLES_RENDER_PT_passes_lightgroups, CYCLES_RENDER_PT_filter, CYCLES_RENDER_PT_override, CYCLES_PT_post_processing, @@ -2220,6 +2248,7 @@ classes = ( CYCLES_OBJECT_PT_shading_shadow_terminator, CYCLES_OBJECT_PT_shading_gi_approximation, CYCLES_OBJECT_PT_shading_caustics, + CYCLES_OBJECT_PT_lightgroup, CYCLES_OBJECT_PT_visibility, CYCLES_OBJECT_PT_visibility_ray_visibility, CYCLES_OBJECT_PT_visibility_culling, |