Fix random walk SSS issues with different base and subsurface color.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 12 Feb 2018 20:08:59 +0000 (21:08 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 12 Feb 2018 20:08:59 +0000 (21:08 +0100)
Burley SSS uses a bit of strange thing where the albedo and closure weight are
different, which makes the subsurface color act a bit like a subsurface radius
indirectly by the way the Burley SSS profile works.

This can't work for random walk SSS though, and it's not clear to me that this
is actually a good idea since it's really the subsurface radius that is supposed
to control this. For now I'll leave Burley SSS working the same to not break
backwards compatibility.

intern/cycles/kernel/shaders/node_principled_bsdf.osl
intern/cycles/kernel/svm/svm_closure.h

index fc0a1c894da0129e50b58c393af5722c9d00f514..6f54ba3a4621756bbe60dc0582010eb342bf6634 100644 (file)
@@ -63,7 +63,7 @@ shader node_principled_bsdf(
                                BSDF = mixed_ss_base_color * bssrdf("principled", Normal, Subsurface * SubsurfaceRadius, SubsurfaceColor, "roughness", Roughness);
                        }
                        else {
-                               BSDF = mixed_ss_base_color * bssrdf("principled_random_walk", Normal, Subsurface * SubsurfaceRadius, SubsurfaceColor, "roughness", Roughness);
+                               BSDF = mixed_ss_base_color * bssrdf("principled_random_walk", Normal, Subsurface * SubsurfaceRadius, mixed_ss_base_color, "roughness", Roughness);
                        }
                }
                else {
index fa43e1b60d0ef08a4a668a6aea068619469d7fb6..5398f36c26718104997fb4de997a5b1a078bac93 100644 (file)
@@ -187,7 +187,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
 
                                        if(bssrdf) {
                                                bssrdf->radius = subsurface_radius * subsurface;
-                                               bssrdf->albedo = subsurface_color;
+                                               bssrdf->albedo = (subsurface_method == CLOSURE_BSSRDF_PRINCIPLED_ID)? subsurface_color:  mixed_ss_base_color;
                                                bssrdf->texture_blur = 0.0f;
                                                bssrdf->sharpness = 0.0f;
                                                bssrdf->N = N;