diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-03-25 20:30:39 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-03-26 15:00:09 +0300 |
commit | bd2b1a67a7b9444cc0dbabe0f46e5a512c3eb7e5 (patch) | |
tree | 45e2da262a20f6000358cb50b1813d17db74d385 /intern/cycles/kernel/kernel_subsurface.h | |
parent | 08b9b95147a983af492f0f9db948b680590b448d (diff) |
Fix T74939: Random Walk subsurface appearance in OptiX does not match other engines
Random Walk subsurface scattering did look different with OptiX because transmittance is
calculated based on the hit distance, but the OptiX implementation of `scene_intersect_local`
would return the distance in world space, while the Cycles BVH version returns it in object
space. This fixes the problem by simply skipping the object->world transforms in all the
places using the result of `scene_intersect_local` with OptiX.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7232
Diffstat (limited to 'intern/cycles/kernel/kernel_subsurface.h')
-rw-r--r-- | intern/cycles/kernel/kernel_subsurface.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index 23e30db1b08..ed8572467ea 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -428,12 +428,17 @@ ccl_device_noinline hit = (ss_isect->num_hits > 0); if (hit) { +#ifdef __KERNEL_OPTIX__ + /* t is always in world space with OptiX. */ + t = ss_isect->hits[0].t; +#else /* Compute world space distance to surface hit. */ float3 D = ray->D; object_inverse_dir_transform(kg, sd, &D); D = normalize(D) * ss_isect->hits[0].t; object_dir_transform(kg, sd, &D); t = len(D); +#endif } /* Advance to new scatter location. */ |