[Bf-blender-cvs] [2a570c1f4b8] temp-pbvh-split: Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs

Olivier Maury noreply at git.blender.org
Fri Jun 3 01:16:27 CEST 2022


Commit: 2a570c1f4b8c25bc3a88d5c32414681796a79e07
Author: Olivier Maury
Date:   Tue May 10 18:50:54 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB2a570c1f4b8c25bc3a88d5c32414681796a79e07

Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs

Differential Revision: https://developer.blender.org/D14901

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

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

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

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(



More information about the Bf-blender-cvs mailing list