From f0a42f2b5f3e6518e9484317bacca7d9e1bd0196 Mon Sep 17 00:00:00 2001 From: teachmain Date: Wed, 16 Oct 2024 14:54:37 +0800 Subject: [PATCH] Fix thin glass problem --- zenovis/xinxinoptix/DisneyBSDF.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zenovis/xinxinoptix/DisneyBSDF.h b/zenovis/xinxinoptix/DisneyBSDF.h index 12766a4a99..1716320f07 100644 --- a/zenovis/xinxinoptix/DisneyBSDF.h +++ b/zenovis/xinxinoptix/DisneyBSDF.h @@ -462,8 +462,9 @@ namespace DisneyBSDF{ } else { if(thin) { - vec3 t = sqrt(mix(mat.transColor, mat.diffractColor, mat.diffraction)) * glassWt; - float tmpPdf = (reflectance==false)? 0.0f:1.0f; + vec3 t = sqrt(mix(mat.transColor, mat.diffractColor, mat.diffraction)) * glassWt / (1e-6+abs(wi.z)); + float F = BRDFBasics::DielectricFresnel(abs(wo.z), entering?mat.ior:1.0/mat.ior); + float tmpPdf = reflectance ? (1.0f-F) : 0.0f; t = t * (tmpPdf>0.0f?1.0f:0.0f); tterm = tterm + t; f = f + t;