[Bf-blender-cvs] [3c54ed4b3ad] cycles-x: Fix T90010: Cycles X random walk discontinuity between low and zero albedo

Brecht Van Lommel noreply at git.blender.org
Fri Sep 10 15:55:48 CEST 2021


Commit: 3c54ed4b3adb1617bd511b633c87df7e7ea55691
Author: Brecht Van Lommel
Date:   Fri Sep 10 15:47:08 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB3c54ed4b3adb1617bd511b633c87df7e7ea55691

Fix T90010: Cycles X random walk discontinuity between low and zero albedo

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

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

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

diff --git a/intern/cycles/kernel/integrator/integrator_subsurface.h b/intern/cycles/kernel/integrator/integrator_subsurface.h
index c22575c29bb..1629677e0f8 100644
--- a/intern/cycles/kernel/integrator/integrator_subsurface.h
+++ b/intern/cycles/kernel/integrator/integrator_subsurface.h
@@ -199,6 +199,23 @@ ccl_device void subsurface_random_walk_coefficients(const float3 albedo,
    * albedo, as well as closure mixing and Fresnel weights. Divide out the albedo
    * which will be added through scattering. */
   *throughput = safe_divide_color(*throughput, albedo);
+
+  /* With low albedo values (like 0.025) we get diffusion_length 1.0 and
+   * infinite phase functions. To avoid a sharp discontinuity as we go from
+   * such values to 0.0, increase alpha and reduce the throughput to compensate. */
+  const float min_alpha = 0.2f;
+  if (alpha_x < min_alpha) {
+    (*throughput).x *= alpha_x / min_alpha;
+    alpha_x = min_alpha;
+  }
+  if (alpha_y < min_alpha) {
+    (*throughput).y *= alpha_y / min_alpha;
+    alpha_y = min_alpha;
+  }
+  if (alpha_z < min_alpha) {
+    (*throughput).z *= alpha_z / min_alpha;
+    alpha_z = min_alpha;
+  }
 }
 
 /* References for Dwivedi sampling:



More information about the Bf-blender-cvs mailing list