From 8639bf013cdc93ee13fb6eec3f49203625a13e01 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Sat, 22 Jul 2023 04:01:41 +0200 Subject: [PATCH] Cycles: Fix MNEE not accounting for closure Fresnel Previously Glass Fresnel used to get baked into the closure weight, so the MNEE code could just ignore it. However, now that it's part of the closure implementation, we need to account for it in the MNEE throughput calculation as well. --- intern/cycles/kernel/integrator/mnee.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/intern/cycles/kernel/integrator/mnee.h b/intern/cycles/kernel/integrator/mnee.h index 7af104f6096..2c1434dbc10 100644 --- a/intern/cycles/kernel/integrator/mnee.h +++ b/intern/cycles/kernel/integrator/mnee.h @@ -623,6 +623,8 @@ ccl_device_forceinline Spectrum mnee_eval_bsdf_contribution(ccl_private ShaderCl G = bsdf_G(alpha2, cosNI, cosNO); } + Spectrum F = microfacet_fresnel(bsdf, wi, Ht, true); + /* * bsdf_do = (1 - F) * D_do * G * |h.wi| / (n.wi * n.wo) * pdf_dh = D_dh * cosThetaM @@ -631,7 +633,7 @@ ccl_device_forceinline Spectrum mnee_eval_bsdf_contribution(ccl_private ShaderCl * contribution = bsdf_do * |do/dh| * |n.wo / n.h| / pdf_dh * = (1 - F) * G * |h.wi / (n.wi * n.h^2)| */ - return bsdf->weight * G * fabsf(cosHI / (cosNI * sqr(cosThetaM))); + return bsdf->weight * F * G * fabsf(cosHI / (cosNI * sqr(cosThetaM))); } /* Compute transfer matrix determinant |T1| = |dx1/dxn| (and |dh/dx| in the process) */ -- 2.33.8