From f6bca9924779a98f7cf4e3c12a500a46b5db519c Mon Sep 17 00:00:00 2001 From: zhxx1987 Date: Wed, 3 Jan 2024 22:44:11 +0800 Subject: [PATCH 1/2] bug fix --- zenovis/xinxinoptix/DisneyBSDF.h | 10 +++++----- zenovis/xinxinoptix/TraceStuff.h | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/zenovis/xinxinoptix/DisneyBSDF.h b/zenovis/xinxinoptix/DisneyBSDF.h index c0b8d522d2..801cd5f2d8 100644 --- a/zenovis/xinxinoptix/DisneyBSDF.h +++ b/zenovis/xinxinoptix/DisneyBSDF.h @@ -392,7 +392,7 @@ namespace DisneyBSDF{ { vec3 d = BRDFBasics::EvalDisneyDiffuse(thin? mat.basecolor:mix(mat.basecolor,mat.sssColor,mat.subsurface), mat.subsurface, mat.roughness, mat.sheen, - Csheen, wo, wi, wm, tmpPdf) * dielectricWt * illum; + Csheen, wo, wi, wm, tmpPdf) * dielectricWt; dterm = dterm + d; f = f + d; fPdf += tmpPdf * diffPr ; @@ -403,7 +403,7 @@ namespace DisneyBSDF{ float ax, ay; BRDFBasics::CalculateAnisotropicParams(mat.roughness,mat.anisotropic,ax,ay); vec3 s = BRDFBasics::EvalMicrofacetReflection(ax, ay, wo, wi, wm, - mix(Cspec0, vec3(1.0f), F) * mat.specular, tmpPdf) * dielectricWt * illum; + mix(Cspec0, vec3(1.0f), F) * mat.specular, tmpPdf) * dielectricWt; sterm = sterm + s; f = f + s; fPdf += tmpPdf * dielectricPr; @@ -413,7 +413,7 @@ namespace DisneyBSDF{ vec3 F = mix(mat.basecolor, vec3(1.0), BRDFBasics::SchlickWeight(HoV)); float ax, ay; BRDFBasics::CalculateAnisotropicParams(mat.roughness,mat.anisotropic,ax,ay); - vec3 s = BRDFBasics::EvalMicrofacetReflection(ax, ay, wo, wi, wm, F, tmpPdf) * metalWt * illum; + vec3 s = BRDFBasics::EvalMicrofacetReflection(ax, ay, wo, wi, wm, F, tmpPdf) * metalWt; sterm = sterm + s; f = f + s; fPdf += tmpPdf * metalPr; @@ -451,7 +451,7 @@ namespace DisneyBSDF{ wo, wi, wm, vec3(F), tmpPdf); - vec3 t = brdf * glassWt * illum; + vec3 t = brdf * glassWt; tterm = tterm + t; f = f + t; fPdf += tmpPdf * glassPr * (1.0 - F); @@ -464,7 +464,7 @@ namespace DisneyBSDF{ { vec3 wm = normalize(wi + wo); vec3 s = BRDFBasics::EvalClearcoat(mat.clearcoatRoughness, wo, wi, - wm, tmpPdf) * 0.25 * mat.clearcoat * illum; + wm, tmpPdf) * 0.25 * mat.clearcoat; sterm = sterm + s; f = f + s; fPdf += tmpPdf * clearCtPr; diff --git a/zenovis/xinxinoptix/TraceStuff.h b/zenovis/xinxinoptix/TraceStuff.h index 30971c3b09..bbd8997710 100644 --- a/zenovis/xinxinoptix/TraceStuff.h +++ b/zenovis/xinxinoptix/TraceStuff.h @@ -151,16 +151,16 @@ struct RadiancePRD } void offsetUpdateRay(float3& P, float3 new_dir) { - double x = (double)(P.x) - (double)(this->camPos.x); - double y = (double)(P.y) - (double)(this->camPos.y); - double z = (double)(P.z) - (double)(this->camPos.z); + double x = (double)(P.x); + double y = (double)(P.y); + double z = (double)(P.z); auto beforeOffset = make_float3(x, y, z); //this->origin = P; this->direction = new_dir; offsetRay(beforeOffset, new_dir); - double x2 = (double)(beforeOffset.x) + (double)(this->camPos.x); - double y2 = (double)(beforeOffset.y) + (double)(this->camPos.y); - double z2 = (double)(beforeOffset.z) + (double)(this->camPos.z); + double x2 = (double)(beforeOffset.x); + double y2 = (double)(beforeOffset.y); + double z2 = (double)(beforeOffset.z); this->origin = make_float3(x2, y2, z2); } From 73f018af4d1da5cc47e84511b7763a30d9f4b35b Mon Sep 17 00:00:00 2001 From: zhxx1987 Date: Wed, 3 Jan 2024 22:48:32 +0800 Subject: [PATCH 2/2] bug fix --- zenovis/xinxinoptix/DeflMatShader.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zenovis/xinxinoptix/DeflMatShader.cu b/zenovis/xinxinoptix/DeflMatShader.cu index 51ec757c5e..63ab520810 100644 --- a/zenovis/xinxinoptix/DeflMatShader.cu +++ b/zenovis/xinxinoptix/DeflMatShader.cu @@ -860,7 +860,7 @@ extern "C" __global__ void __closesthit__radiance() ShadowPRD shadowPRD {}; shadowPRD.seed = prd->seed; shadowPRD.attanuation = make_float3(1.0f, 1.0f, 1.0f); - shadowPRD.nonThinTransHit = (mats.thin == false && mats.specTrans > 0) ? 1 : 0; + shadowPRD.nonThinTransHit = (mats.thin < 0.5f && mats.specTrans > 0) ? 1 : 0; shadowPRD.origin = rtgems::offset_ray(P, prd->geometryNormal); // camera space auto shadingP = rtgems::offset_ray(P + params.cam.eye, prd->geometryNormal); // world space @@ -884,7 +884,7 @@ extern "C" __global__ void __closesthit__radiance() prd->done = true; } - if(mats.thin<0.5f || mats.doubleSide<0.5f){ + if(mats.thin<0.5f && mats.doubleSide<0.5f){ prd->origin = rtgems::offset_ray(P, (next_ray_is_going_inside)? -prd->geometryNormal : prd->geometryNormal); } else {