diff options
-rw-r--r-- | intern/cycles/kernel/closure/bsdf.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_diffuse.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_diffuse_ramp.h | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_hair.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_microfacet.h | 42 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_microfacet_multi.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_oren_nayar.h | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_phong_ramp.h | 7 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_principled_diffuse.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_principled_sheen.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_reflection.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_refraction.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_toon.h | 22 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_transparent.h | 2 |
16 files changed, 116 insertions, 28 deletions
diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h index 50a047b3992..011155cdf5f 100644 --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@ -445,6 +445,11 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg, } } +#ifdef WITH_CYCLES_DEBUG + kernel_assert(*pdf >= 0.0f); + kernel_assert(eval->x >= 0.0f && eval->y >= 0.0f && eval->z >= 0.0f); +#endif + return label; } @@ -635,7 +640,10 @@ ccl_device_inline } } } - +#ifdef WITH_CYCLES_DEBUG + kernel_assert(*pdf >= 0.0f); + kernel_assert(eval.x >= 0.0f && eval.y >= 0.0f && eval.z >= 0.0f); +#endif return eval; } diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h index a7694062935..47066542122 100644 --- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h +++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h @@ -53,9 +53,10 @@ bsdf_ashikhmin_shirley_eval_reflect(ccl_private const ShaderClosure *sc, float out = 0.0f; - if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) + if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); - + } if (NdotI > 0.0f && NdotO > 0.0f) { NdotI = fmaxf(NdotI, 1e-6f); NdotO = fmaxf(NdotO, 1e-6f); @@ -112,6 +113,7 @@ ccl_device float3 bsdf_ashikhmin_shirley_eval_transmit(ccl_private const ShaderC const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h index d396e601338..3d7906eef7d 100644 --- a/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h +++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h @@ -48,9 +48,10 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClo float cosNH = dot(N, H); float cosHO = fabsf(dot(I, H)); - if (!(fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f)) + if (!(fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f)) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); - + } float cosNHdivHO = cosNH / cosHO; cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f); @@ -62,7 +63,7 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClo float cotangent2 = (cosNH * cosNH) / sinNH2; float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4; - float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically + float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically float out = 0.25f * (D * G) / cosNO; @@ -70,6 +71,7 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClo return make_float3(out, out, out); } + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -78,6 +80,7 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_transmit(ccl_private const ShaderCl const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -122,7 +125,7 @@ ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc, float cotangent2 = (cosNH * cosNH) / sinNH2; float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4; - float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically + float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically float power = 0.25f * (D * G) / cosNO; @@ -134,12 +137,15 @@ ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc, *domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy; #endif } - else + else { *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); + } } - else + else { *pdf = 0.0f; - + *eval = make_float3(0.0f, 0.0f, 0.0f); + } return LABEL_REFLECT | LABEL_DIFFUSE; } diff --git a/intern/cycles/kernel/closure/bsdf_diffuse.h b/intern/cycles/kernel/closure/bsdf_diffuse.h index 18abdac8128..759ad03f8e8 100644 --- a/intern/cycles/kernel/closure/bsdf_diffuse.h +++ b/intern/cycles/kernel/closure/bsdf_diffuse.h @@ -44,6 +44,7 @@ ccl_device float3 bsdf_diffuse_eval_transmit(ccl_private const ShaderClosure *sc const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -74,9 +75,10 @@ ccl_device int bsdf_diffuse_sample(ccl_private const ShaderClosure *sc, *domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy; #endif } - else + else { *pdf = 0.0f; - + *eval = make_float3(0.0f, 0.0f, 0.0f); + } return LABEL_REFLECT | LABEL_DIFFUSE; } @@ -93,6 +95,7 @@ ccl_device float3 bsdf_translucent_eval_reflect(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -138,6 +141,7 @@ ccl_device int bsdf_translucent_sample(ccl_private const ShaderClosure *sc, } else { *pdf = 0; + *eval = make_float3(0.0f, 0.0f, 0.0f); } return LABEL_TRANSMIT | LABEL_DIFFUSE; } diff --git a/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h b/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h index d1e31641431..aa4c091f587 100644 --- a/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h +++ b/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h @@ -93,9 +93,10 @@ ccl_device int bsdf_diffuse_ramp_sample(ccl_private const ShaderClosure *sc, *domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy; # endif } - else + else { *pdf = 0.0f; - + *eval = make_float3(0.0f, 0.0f, 0.0f); + } return LABEL_REFLECT | LABEL_DIFFUSE; } diff --git a/intern/cycles/kernel/closure/bsdf_hair.h b/intern/cycles/kernel/closure/bsdf_hair.h index 0554d6e92fc..a136ed05800 100644 --- a/intern/cycles/kernel/closure/bsdf_hair.h +++ b/intern/cycles/kernel/closure/bsdf_hair.h @@ -89,6 +89,7 @@ ccl_device float3 bsdf_hair_transmission_eval_reflect(ccl_private const ShaderCl const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -97,6 +98,7 @@ ccl_device float3 bsdf_hair_reflection_eval_transmit(ccl_private const ShaderClo const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index d4c3c3509db..db50712f9f0 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -368,8 +368,10 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(ccl_private const ShaderClosu bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID; float3 N = bsdf->N; - if (m_refractive || alpha_x * alpha_y <= 1e-7f) + if (m_refractive || alpha_x * alpha_y <= 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); + } float cosNO = dot(N, I); float cosNI = dot(N, omega_in); @@ -482,15 +484,18 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(ccl_private const ShaderClos bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID; float3 N = bsdf->N; - if (!m_refractive || alpha_x * alpha_y <= 1e-7f) + if (!m_refractive || alpha_x * alpha_y <= 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); + } float cosNO = dot(N, I); float cosNI = dot(N, omega_in); - if (cosNO <= 0 || cosNI >= 0) + if (cosNO <= 0 || cosNI >= 0) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); /* vectors on same side -- not possible */ - + } /* compute half-vector of the refraction (eq. 16) */ float3 ht = -(m_eta * omega_in + I); float3 Ht = normalize(ht); @@ -673,6 +678,10 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg, *domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy; #endif } + else { + *eval = make_float3(0.0f, 0.0f, 0.0f); + *pdf = 0.0f; + } } } else { @@ -744,6 +753,10 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg, *eval = make_float3(out, out, out); } } + else { + *eval = make_float3(0.0f, 0.0f, 0.0f); + *pdf = 0.0f; + } } } else { @@ -833,8 +846,10 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_reflect(ccl_private const Shader bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID; float3 N = bsdf->N; - if (m_refractive || alpha_x * alpha_y <= 1e-7f) + if (m_refractive || alpha_x * alpha_y <= 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); + } float cosNO = dot(N, I); float cosNI = dot(N, omega_in); @@ -913,15 +928,18 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(ccl_private const Shade bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID; float3 N = bsdf->N; - if (!m_refractive || alpha_x * alpha_y <= 1e-7f) + if (!m_refractive || alpha_x * alpha_y <= 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); + } float cosNO = dot(N, I); float cosNI = dot(N, omega_in); - if (cosNO <= 0 || cosNI >= 0) + if (cosNO <= 0 || cosNI >= 0) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); - + } /* compute half-vector of the refraction (eq. 16) */ float3 ht = -(m_eta * omega_in + I); float3 Ht = normalize(ht); @@ -1064,6 +1082,10 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg, *domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy; #endif } + else { + *eval = make_float3(0.0f, 0.0f, 0.0f); + *pdf = 0.0f; + } } } else { @@ -1136,6 +1158,10 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg, *eval = make_float3(out, out, out); } } + else { + *eval = make_float3(0.0f, 0.0f, 0.0f); + *pdf = 0.0f; + } } } else { diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h index 5aa9c8f0b16..c646c9ef01d 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h @@ -434,6 +434,7 @@ ccl_device float3 bsdf_microfacet_multi_ggx_eval_reflect(ccl_private const Shade ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -572,6 +573,7 @@ bsdf_microfacet_multi_ggx_glass_eval_transmit(ccl_private const ShaderClosure *s ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -604,6 +606,7 @@ ccl_device float3 bsdf_microfacet_multi_ggx_glass_eval_reflect(ccl_private const ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } diff --git a/intern/cycles/kernel/closure/bsdf_oren_nayar.h b/intern/cycles/kernel/closure/bsdf_oren_nayar.h index 47ad7b85942..56c7ec869c7 100644 --- a/intern/cycles/kernel/closure/bsdf_oren_nayar.h +++ b/intern/cycles/kernel/closure/bsdf_oren_nayar.h @@ -68,6 +68,7 @@ ccl_device float3 bsdf_oren_nayar_eval_transmit(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } diff --git a/intern/cycles/kernel/closure/bsdf_phong_ramp.h b/intern/cycles/kernel/closure/bsdf_phong_ramp.h index 819c51e2935..74a1f7ae090 100644 --- a/intern/cycles/kernel/closure/bsdf_phong_ramp.h +++ b/intern/cycles/kernel/closure/bsdf_phong_ramp.h @@ -64,7 +64,7 @@ ccl_device float3 bsdf_phong_ramp_eval_reflect(ccl_private const ShaderClosure * return bsdf_phong_ramp_get_color(bsdf->colors, cosp) * out; } } - + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -73,6 +73,7 @@ ccl_device float3 bsdf_phong_ramp_eval_transmit(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -122,6 +123,10 @@ ccl_device int bsdf_phong_ramp_sample(ccl_private const ShaderClosure *sc, } } } + else { + *eval = make_float3(0.0f, 0.0f, 0.0f); + *pdf = 0.0f; + } return LABEL_REFLECT | LABEL_GLOSSY; } diff --git a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h index 208540bd388..5a7020e82d2 100644 --- a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h +++ b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h @@ -135,6 +135,7 @@ ccl_device float3 bsdf_principled_diffuse_eval_transmit(ccl_private const Shader const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -168,6 +169,7 @@ ccl_device int bsdf_principled_diffuse_sample(ccl_private const ShaderClosure *s } else { *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); } return LABEL_REFLECT | LABEL_DIFFUSE; } diff --git a/intern/cycles/kernel/closure/bsdf_principled_sheen.h b/intern/cycles/kernel/closure/bsdf_principled_sheen.h index ea2ea03adb9..3a96a93db73 100644 --- a/intern/cycles/kernel/closure/bsdf_principled_sheen.h +++ b/intern/cycles/kernel/closure/bsdf_principled_sheen.h @@ -86,6 +86,7 @@ ccl_device float3 bsdf_principled_sheen_eval_transmit(ccl_private const ShaderCl const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -120,6 +121,7 @@ ccl_device int bsdf_principled_sheen_sample(ccl_private const ShaderClosure *sc, #endif } else { + *eval = make_float3(0.0f, 0.0f, 0.0f); *pdf = 0.0f; } return LABEL_REFLECT | LABEL_DIFFUSE; diff --git a/intern/cycles/kernel/closure/bsdf_reflection.h b/intern/cycles/kernel/closure/bsdf_reflection.h index 6887c4b09a0..c8db2b7cf13 100644 --- a/intern/cycles/kernel/closure/bsdf_reflection.h +++ b/intern/cycles/kernel/closure/bsdf_reflection.h @@ -23,6 +23,7 @@ ccl_device float3 bsdf_reflection_eval_reflect(ccl_private const ShaderClosure * const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -31,6 +32,7 @@ ccl_device float3 bsdf_reflection_eval_transmit(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -64,6 +66,10 @@ ccl_device int bsdf_reflection_sample(ccl_private const ShaderClosure *sc, *eval = make_float3(1e6f, 1e6f, 1e6f); } } + else { + *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); + } return LABEL_REFLECT | LABEL_SINGULAR; } diff --git a/intern/cycles/kernel/closure/bsdf_refraction.h b/intern/cycles/kernel/closure/bsdf_refraction.h index 88497525960..862e774da87 100644 --- a/intern/cycles/kernel/closure/bsdf_refraction.h +++ b/intern/cycles/kernel/closure/bsdf_refraction.h @@ -23,6 +23,7 @@ ccl_device float3 bsdf_refraction_eval_reflect(ccl_private const ShaderClosure * const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -31,6 +32,7 @@ ccl_device float3 bsdf_refraction_eval_transmit(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -82,6 +84,10 @@ ccl_device int bsdf_refraction_sample(ccl_private const ShaderClosure *sc, *domega_in_dy = dTdy; #endif } + else { + *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); + } return LABEL_TRANSMIT | LABEL_SINGULAR; } diff --git a/intern/cycles/kernel/closure/bsdf_toon.h b/intern/cycles/kernel/closure/bsdf_toon.h index 53ccb683721..0400fc61860 100644 --- a/intern/cycles/kernel/closure/bsdf_toon.h +++ b/intern/cycles/kernel/closure/bsdf_toon.h @@ -67,7 +67,7 @@ ccl_device float3 bsdf_diffuse_toon_eval_reflect(ccl_private const ShaderClosure *pdf = 0.5f * M_1_PI_F / (1.0f - cosf(sample_angle)); return *pdf * eval; } - + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -76,6 +76,7 @@ ccl_device float3 bsdf_diffuse_toon_eval_transmit(ccl_private const ShaderClosur const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -110,8 +111,14 @@ ccl_device int bsdf_diffuse_toon_sample(ccl_private const ShaderClosure *sc, *domega_in_dy = (2.0f * dot(bsdf->N, dIdy)) * bsdf->N - dIdy; #endif } - else + else { + *eval = make_float3(0.f, 0.f, 0.f); *pdf = 0.0f; + } + } + else { + *eval = make_float3(0.f, 0.f, 0.f); + *pdf = 0.0f; } return LABEL_REFLECT | LABEL_DIFFUSE; @@ -152,7 +159,7 @@ ccl_device float3 bsdf_glossy_toon_eval_reflect(ccl_private const ShaderClosure *pdf = 0.5f * M_1_PI_F / (1.0f - cosf(sample_angle)); return *pdf * eval; } - + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -161,6 +168,7 @@ ccl_device float3 bsdf_glossy_toon_eval_transmit(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -203,11 +211,15 @@ ccl_device int bsdf_glossy_toon_sample(ccl_private const ShaderClosure *sc, *domega_in_dy = (2 * dot(bsdf->N, dIdy)) * bsdf->N - dIdy; #endif } - else + else { *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); + } } - else + else { *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); + } } return LABEL_GLOSSY | LABEL_REFLECT; diff --git a/intern/cycles/kernel/closure/bsdf_transparent.h b/intern/cycles/kernel/closure/bsdf_transparent.h index 2a0bd453009..636d9d664f2 100644 --- a/intern/cycles/kernel/closure/bsdf_transparent.h +++ b/intern/cycles/kernel/closure/bsdf_transparent.h @@ -64,6 +64,7 @@ ccl_device float3 bsdf_transparent_eval_reflect(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } @@ -72,6 +73,7 @@ ccl_device float3 bsdf_transparent_eval_transmit(ccl_private const ShaderClosure const float3 omega_in, ccl_private float *pdf) { + *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } |