diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-11-16 21:34:13 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-11-16 21:44:45 +0300 |
commit | 7293c1b3578e015a00e8b1e282baa62f51c5b4c4 (patch) | |
tree | a72d457bbd40f9286af8a046a388c447d0d65bce /intern/cycles/kernel/integrator | |
parent | 1572c4d3d3317209bb846ca2d05cafeed06d1ead (diff) |
Fix T93106: Cycles SSS not working with normals pointing inside
Diffstat (limited to 'intern/cycles/kernel/integrator')
-rw-r--r-- | intern/cycles/kernel/integrator/subsurface.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/integrator/subsurface_disk.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/intern/cycles/kernel/integrator/subsurface.h b/intern/cycles/kernel/integrator/subsurface.h index 9010318257f..59b0cd2596c 100644 --- a/intern/cycles/kernel/integrator/subsurface.h +++ b/intern/cycles/kernel/integrator/subsurface.h @@ -71,6 +71,10 @@ ccl_device int subsurface_bounce(KernelGlobals kg, } # endif + if (sd->flag & SD_BACKFACING) { + path_flag |= PATH_RAY_SUBSURFACE_BACKFACING; + } + INTEGRATOR_STATE_WRITE(state, path, throughput) *= weight; INTEGRATOR_STATE_WRITE(state, path, flag) = path_flag; diff --git a/intern/cycles/kernel/integrator/subsurface_disk.h b/intern/cycles/kernel/integrator/subsurface_disk.h index 6146b8c41fc..22327268e02 100644 --- a/intern/cycles/kernel/integrator/subsurface_disk.h +++ b/intern/cycles/kernel/integrator/subsurface_disk.h @@ -47,6 +47,7 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg, const float time = INTEGRATOR_STATE(state, ray, time); const float3 Ng = INTEGRATOR_STATE(state, subsurface, Ng); const int object = INTEGRATOR_STATE(state, isect, object); + const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag); /* Read subsurface scattering parameters. */ const float3 radius = INTEGRATOR_STATE(state, subsurface, radius); @@ -123,6 +124,9 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg, const int object = ss_isect.hits[hit].object; const int object_flag = kernel_tex_fetch(__object_flag, object); float3 hit_Ng = ss_isect.Ng[hit]; + if (path_flag & PATH_RAY_SUBSURFACE_BACKFACING) { + hit_Ng = -hit_Ng; + } if (object_flag & SD_OBJECT_NEGATIVE_SCALE_APPLIED) { hit_Ng = -hit_Ng; } |