diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-28 22:49:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-28 22:53:30 +0300 |
commit | f2cc38a62b50b0819cd23a44399c40d5d8b466d1 (patch) | |
tree | 4913bca4ed75303829feeb2703ec140efe67e9c4 /intern | |
parent | 049510f42580b7948ddca5eb36fd30dbe0143626 (diff) |
Fix T92255: Cycles Christensen-Burley render errors with scaled objects
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/integrator/subsurface_disk.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/intern/cycles/kernel/integrator/subsurface_disk.h b/intern/cycles/kernel/integrator/subsurface_disk.h index e1cce13fb30..6146b8c41fc 100644 --- a/intern/cycles/kernel/integrator/subsurface_disk.h +++ b/intern/cycles/kernel/integrator/subsurface_disk.h @@ -119,9 +119,6 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg, float sum_weights = 0.0f; for (int hit = 0; hit < num_eval_hits; hit++) { - /* Quickly retrieve P and Ng without setting up ShaderData. */ - const float3 hit_P = ray.P + ray.D * ss_isect.hits[hit].t; - /* Get geometric normal. */ const int object = ss_isect.hits[hit].object; const int object_flag = kernel_tex_fetch(__object_flag, object); @@ -131,11 +128,24 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg, } if (!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { + /* Transform normal to world space. */ Transform itfm; - object_fetch_transform_motion_test(kg, object, time, &itfm); + Transform tfm = object_fetch_transform_motion_test(kg, object, time, &itfm); hit_Ng = normalize(transform_direction_transposed(&itfm, hit_Ng)); + + /* Transform t to world space, except for OptiX where it already is. */ +#ifdef __KERNEL_OPTIX__ + (void)tfm; +#else + float3 D = transform_direction(&itfm, ray.D); + D = normalize(D) * ss_isect.hits[hit].t; + ss_isect.hits[hit].t = len(transform_direction(&tfm, D)); +#endif } + /* Quickly retrieve P and Ng without setting up ShaderData. */ + const float3 hit_P = ray.P + ray.D * ss_isect.hits[hit].t; + /* Probability densities for local frame axes. */ const float pdf_N = pick_pdf_N * fabsf(dot(disk_N, hit_Ng)); const float pdf_T = pick_pdf_T * fabsf(dot(disk_T, hit_Ng)); |