[Bf-blender-cvs] [f2cc38a62b5] blender-v3.0-release: Fix T92255: Cycles Christensen-Burley render errors with scaled objects

Brecht Van Lommel noreply at git.blender.org
Thu Oct 28 22:21:42 CEST 2021


Commit: f2cc38a62b50b0819cd23a44399c40d5d8b466d1
Author: Brecht Van Lommel
Date:   Thu Oct 28 21:49:32 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rBf2cc38a62b50b0819cd23a44399c40d5d8b466d1

Fix T92255: Cycles Christensen-Burley render errors with scaled objects

===================================================================

M	intern/cycles/kernel/integrator/subsurface_disk.h

===================================================================

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));



More information about the Bf-blender-cvs mailing list