Fix T51956: color noise with principled sss, radius 0 and branched path.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 2 Jul 2017 17:10:11 +0000 (19:10 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 2 Jul 2017 17:21:08 +0000 (19:21 +0200)
intern/cycles/kernel/closure/bsdf.h
intern/cycles/kernel/closure/bsdf_principled_diffuse.h

index a04c157dc40dcb205cefd9fc0f8021ed215974c7..86a00d2124db29a39cec42185fbcd2bf52521bec 100644 (file)
@@ -423,6 +423,11 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b)
                case CLOSURE_BSDF_HAIR_REFLECTION_ID:
                case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
                        return bsdf_hair_merge(a, b);
+#ifdef __PRINCIPLED__
+               case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
+               case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID:
+                       return bsdf_principled_diffuse_merge(a, b);
+#endif
 #ifdef __VOLUME__
                case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
                        return volume_henyey_greenstein_merge(a, b);
index 215c32e1ffb0780592c6345be154cf08202432c7..f8ca64293b0653c92c830f119743a401aa7d9d8b 100644 (file)
@@ -58,6 +58,14 @@ ccl_device int bsdf_principled_diffuse_setup(PrincipledDiffuseBsdf *bsdf)
        return SD_BSDF|SD_BSDF_HAS_EVAL;
 }
 
+ccl_device bool bsdf_principled_diffuse_merge(const ShaderClosure *a, const ShaderClosure *b)
+{
+       const PrincipledDiffuseBsdf *bsdf_a = (const PrincipledDiffuseBsdf*)a;
+       const PrincipledDiffuseBsdf *bsdf_b = (const PrincipledDiffuseBsdf*)b;
+
+       return (isequal_float3(bsdf_a->N, bsdf_b->N) && bsdf_a->roughness == bsdf_b->roughness);
+}
+
 ccl_device float3 bsdf_principled_diffuse_eval_reflect(const ShaderClosure *sc, const float3 I,
        const float3 omega_in, float *pdf)
 {