[Bf-blender-cvs] [ed541de29dd] master: Fix T91626: Cycles sss behind fully transparent object renders differently

Brecht Van Lommel noreply at git.blender.org
Thu Sep 23 18:32:44 CEST 2021


Commit: ed541de29dd01339736e04d95302e6e20495de54
Author: Brecht Van Lommel
Date:   Thu Sep 23 18:26:22 2021 +0200
Branches: master
https://developer.blender.org/rBed541de29dd01339736e04d95302e6e20495de54

Fix T91626: Cycles sss behind fully transparent object renders differently

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

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

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

diff --git a/intern/cycles/kernel/integrator/integrator_shade_surface.h b/intern/cycles/kernel/integrator/integrator_shade_surface.h
index 73b7cad32be..a24473addcc 100644
--- a/intern/cycles/kernel/integrator/integrator_shade_surface.h
+++ b/intern/cycles/kernel/integrator/integrator_shade_surface.h
@@ -365,19 +365,16 @@ ccl_device bool integrate_surface(INTEGRATOR_STATE_ARGS,
 #ifdef __VOLUME__
   if (!(sd.flag & SD_HAS_ONLY_VOLUME)) {
 #endif
+    const int path_flag = INTEGRATOR_STATE(path, flag);
 
-    {
-      const int path_flag = INTEGRATOR_STATE(path, flag);
 #ifdef __SUBSURFACE__
-      /* Can skip shader evaluation for BSSRDF exit point without bump mapping. */
-      if (!(path_flag & PATH_RAY_SUBSURFACE) || ((sd.flag & SD_HAS_BSSRDF_BUMP)))
+    /* Can skip shader evaluation for BSSRDF exit point without bump mapping. */
+    if (!(path_flag & PATH_RAY_SUBSURFACE) || ((sd.flag & SD_HAS_BSSRDF_BUMP)))
 #endif
-      {
-        /* Evaluate shader. */
-        PROFILING_EVENT(PROFILING_SHADE_SURFACE_EVAL);
-        shader_eval_surface<node_feature_mask>(
-            INTEGRATOR_STATE_PASS, &sd, render_buffer, path_flag);
-      }
+    {
+      /* Evaluate shader. */
+      PROFILING_EVENT(PROFILING_SHADE_SURFACE_EVAL);
+      shader_eval_surface<node_feature_mask>(INTEGRATOR_STATE_PASS, &sd, render_buffer, path_flag);
     }
 
 #ifdef __SUBSURFACE__
@@ -417,17 +414,20 @@ ccl_device bool integrate_surface(INTEGRATOR_STATE_ARGS,
 
     /* Perform path termination. Most paths have already been terminated in
      * the intersect_closest kernel, this is just for emission and for dividing
-     * throughput by the probability at the right moment. */
-    const int path_flag = INTEGRATOR_STATE(path, flag);
-    const float probability = (path_flag & PATH_RAY_TERMINATE_ON_NEXT_SURFACE) ?
-                                  0.0f :
-                                  path_state_continuation_probability(INTEGRATOR_STATE_PASS,
-                                                                      path_flag);
-    if (probability == 0.0f) {
-      return false;
-    }
-    else if (probability != 1.0f) {
-      INTEGRATOR_STATE_WRITE(path, throughput) /= probability;
+     * throughput by the probability at the right moment.
+     *
+     * Also ensure we don't do it twice for SSS at both the entry and exit point. */
+    if (!(path_flag & PATH_RAY_SUBSURFACE)) {
+      const float probability = (path_flag & PATH_RAY_TERMINATE_ON_NEXT_SURFACE) ?
+                                    0.0f :
+                                    path_state_continuation_probability(INTEGRATOR_STATE_PASS,
+                                                                        path_flag);
+      if (probability == 0.0f) {
+        return false;
+      }
+      else if (probability != 1.0f) {
+        INTEGRATOR_STATE_WRITE(path, throughput) /= probability;
+      }
     }
 
 #ifdef __DENOISING_FEATURES__



More information about the Bf-blender-cvs mailing list