diff options
author | Mikhail Matrosov <ktdfly> | 2021-06-28 14:54:18 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-06-28 15:05:22 +0300 |
commit | 9c6a382f9540c8e334a16b7740b5ba6bb294fca9 (patch) | |
tree | f8b4d0f1c557e7ef70c0f417fd22d9abf1912f74 /intern/cycles/blender/addon | |
parent | ce25b5812b4ad2f9c6d29bf254374235bc7100f7 (diff) |
Cycles: reduce shadow terminator artifacts
Offset rays from the flat surface to match where they would be for a smooth
surface as specified by the normals. In the shading panel there is now a
Shading Offset (existing option) and Geometry Offset (new).
The Geometry Offset works as follows:
* 0: disabled
* 0.001: only terminated triangles (normal points to the light, geometry
doesn't) are affected
* 0.1 (default): triangles at grazing angles are affected, and the effect
fades out
* 1: all triangles are affected
Limitations:
* The artifact is still visible in some cases, it could be that some quads
require to be treated specifically as quads.
* Inconsistent normals cause artifacts.
* If small objects cast shadows to a big low poly surface, the shadows can
appear to be in a wrong place - because the surface moved slightly above
the geometry. This can be noticed only at grazing angles to light.
* Approximated surfaces of two non-intersecting low-poly objects can overlap
that causes off-the-wall shadows.
Generally, using one or a few levels of subdivision can get rid of artifacts
faster than before.
Differential Revision: https://developer.blender.org/D11065
Diffstat (limited to 'intern/cycles/blender/addon')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 9 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 26 |
2 files changed, 27 insertions, 8 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index cda1355eb2d..71e2f9fc3a5 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1254,12 +1254,19 @@ class CyclesObjectSettings(bpy.types.PropertyGroup): ) shadow_terminator_offset: FloatProperty( - name="Shadow Terminator Offset", + name="Shadow Terminator Shading Offset", description="Push the shadow terminator towards the light to hide artifacts on low poly geometry", min=0.0, max=1.0, default=0.0, ) + shadow_terminator_geometry_offset: FloatProperty( + name="Shadow Terminator Geometry Offset", + description="Offset rays from the surface to reduce shadow terminator artifact on low poly geometry. Only affects triangles at grazing angles to light", + min=0.0, max=1.0, + default=0.1, + ) + is_shadow_catcher: BoolProperty( name="Shadow Catcher", description="Only render shadows on this object, for compositing renders into real footage", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 62a2fa7f036..3d990467f04 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1223,20 +1223,31 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return CyclesButtonsPanel.poll(context) and (context.object) + if not CyclesButtonsPanel.poll(context): + return False + + ob = context.object + return ob and has_geometry_visibility(ob) + + def draw(self, context): + pass + + +class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel): + bl_label = "Shadow Terminator" + bl_parent_id = "CYCLES_OBJECT_PT_shading" + bl_context = "object" def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) - layout = self.layout + flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True) + ob = context.object cob = ob.cycles - - if has_geometry_visibility(ob): - col = flow.column() - col.prop(cob, "shadow_terminator_offset") + flow.prop(cob, "shadow_terminator_geometry_offset", text="Geometry Offset") + flow.prop(cob, "shadow_terminator_offset", text="Shading Offset") class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel): @@ -2316,6 +2327,7 @@ classes = ( CYCLES_PT_context_material, CYCLES_OBJECT_PT_motion_blur, CYCLES_OBJECT_PT_shading, + CYCLES_OBJECT_PT_shading_shadow_terminator, CYCLES_OBJECT_PT_visibility, CYCLES_OBJECT_PT_visibility_ray_visibility, CYCLES_OBJECT_PT_visibility_culling, |