diff options
author | Matteo Falduto <matteolegna> | 2021-04-01 06:35:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-04-01 13:31:01 +0300 |
commit | a4260ac21977acd5b9cd792f2a68c3aa78dd91cd (patch) | |
tree | 61bdd5358e5279ddb9c13c53bb3079d1d8f79b65 /intern/cycles/blender | |
parent | c859e1afa0dcca1a495c6b25d00bab65bf94be0b (diff) |
Cycles: add a spread setting for area lights
This simulates the effect of a honeycomb or grid placed in front of a softbox.
In practice, it works by attenuating rays coming off-angle as a function of the
provided spread angle parameter.
Setting the parameter to 180 degrees poses no restrictions to the rays, making
the light behave the same way as before this patch.
The total light power is normalized based on the spread angle, so that the
light strength remains the same.
Differential Revision: https://developer.blender.org/D10594
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 21 | ||||
-rw-r--r-- | intern/cycles/blender/blender_light.cpp | 1 |
2 files changed, 13 insertions, 9 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c9b4dc25cf2..4e8527387c0 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1409,15 +1409,15 @@ class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel): panel_node_draw(layout, light, 'OUTPUT_LIGHT', 'Surface') -class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel): - bl_label = "Spot Shape" +class CYCLES_LIGHT_PT_beam_shape(CyclesButtonsPanel, Panel): + bl_label = "Beam Shape" bl_parent_id = "CYCLES_LIGHT_PT_light" bl_context = "data" @classmethod def poll(cls, context): - light = context.light - return (light and light.type == 'SPOT') and CyclesButtonsPanel.poll(context) + if context.light.type in {'SPOT', 'AREA'}: + return context.light and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -1425,9 +1425,12 @@ class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel): layout.use_property_split = True col = layout.column() - col.prop(light, "spot_size", text="Size") - col.prop(light, "spot_blend", text="Blend", slider=True) - col.prop(light, "show_cone") + if light.type == 'SPOT': + col.prop(light, "spot_size", text="Spot Size") + col.prop(light, "spot_blend", text="Blend", slider=True) + col.prop(light, "show_cone") + elif light.type == 'AREA': + col.prop(light, "spread", text="Spread") class CYCLES_WORLD_PT_preview(CyclesButtonsPanel, Panel): @@ -2284,7 +2287,7 @@ classes = ( CYCLES_LIGHT_PT_preview, CYCLES_LIGHT_PT_light, CYCLES_LIGHT_PT_nodes, - CYCLES_LIGHT_PT_spot, + CYCLES_LIGHT_PT_beam_shape, CYCLES_WORLD_PT_preview, CYCLES_WORLD_PT_surface, CYCLES_WORLD_PT_volume, @@ -2314,7 +2317,7 @@ classes = ( node_panel(CYCLES_WORLD_PT_settings_surface), node_panel(CYCLES_WORLD_PT_settings_volume), node_panel(CYCLES_LIGHT_PT_light), - node_panel(CYCLES_LIGHT_PT_spot), + node_panel(CYCLES_LIGHT_PT_beam_shape) ) diff --git a/intern/cycles/blender/blender_light.cpp b/intern/cycles/blender/blender_light.cpp index ff4ecc5a3f9..283ed7d0adc 100644 --- a/intern/cycles/blender/blender_light.cpp +++ b/intern/cycles/blender/blender_light.cpp @@ -82,6 +82,7 @@ void BlenderSync::sync_light(BL::Object &b_parent, light->set_axisu(transform_get_column(&tfm, 0)); light->set_axisv(transform_get_column(&tfm, 1)); light->set_sizeu(b_area_light.size()); + light->set_spread(b_area_light.spread()); switch (b_area_light.shape()) { case BL::AreaLight::shape_SQUARE: light->set_sizev(light->get_sizeu()); |