diff options
author | Olivier Maury <omaury> | 2022-05-10 19:50:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-05-10 19:51:02 +0300 |
commit | dc55e095e6f2836c65f83c9b1bad2f7d9d98022d (patch) | |
tree | e5a1741db9b8bef6d4b561f5b0518c937f8800b9 /intern/cycles | |
parent | c171c99fa1bd7a5054bf04934a3ddc09678b7100 (diff) |
Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs
Differential Revision: https://developer.blender.org/D14901
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/integrator/mnee.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/intern/cycles/kernel/integrator/mnee.h b/intern/cycles/kernel/integrator/mnee.h index 455d15b28c2..7820d71f15c 100644 --- a/intern/cycles/kernel/integrator/mnee.h +++ b/intern/cycles/kernel/integrator/mnee.h @@ -1026,7 +1026,9 @@ ccl_device_forceinline int kernel_path_mnee_sample(KernelGlobals kg, if (bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID || bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID || bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID || - bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID) { + bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID || + bsdf->type == CLOSURE_BSDF_REFRACTION_ID || + bsdf->type == CLOSURE_BSDF_SHARP_GLASS_ID) { /* Note that CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID and * CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID are treated as * CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID further below. */ @@ -1038,11 +1040,14 @@ ccl_device_forceinline int kernel_path_mnee_sample(KernelGlobals kg, const float eta = (sd_mnee->flag & SD_BACKFACING) ? 1.0f / microfacet_bsdf->ior : microfacet_bsdf->ior; - /* Sample transmissive microfacet bsdf. */ - float bsdf_u, bsdf_v; - path_state_rng_2D(kg, rng_state, PRNG_BSDF_U, &bsdf_u, &bsdf_v); - float2 h = mnee_sample_bsdf_dh( - bsdf->type, microfacet_bsdf->alpha_x, microfacet_bsdf->alpha_y, bsdf_u, bsdf_v); + float2 h = zero_float2(); + if (microfacet_bsdf->alpha_x > 0.f && microfacet_bsdf->alpha_y > 0.f) { + /* Sample transmissive microfacet bsdf. */ + float bsdf_u, bsdf_v; + path_state_rng_2D(kg, rng_state, PRNG_BSDF_U, &bsdf_u, &bsdf_v); + h = mnee_sample_bsdf_dh( + bsdf->type, microfacet_bsdf->alpha_x, microfacet_bsdf->alpha_y, bsdf_u, bsdf_v); + } /* Setup differential geometry on vertex. */ mnee_setup_manifold_vertex( |