From 85793add270ada6b602f15e6ebc53474640c530a Mon Sep 17 00:00:00 2001 From: iaomw Date: Thu, 26 Sep 2024 17:32:48 +0800 Subject: [PATCH 1/2] zhxx patch --- zenovis/xinxinoptix/DisneyBRDF.h | 8 +++++--- zenovis/xinxinoptix/PTKernel.cu | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zenovis/xinxinoptix/DisneyBRDF.h b/zenovis/xinxinoptix/DisneyBRDF.h index 107b78539e..eabde964d8 100644 --- a/zenovis/xinxinoptix/DisneyBRDF.h +++ b/zenovis/xinxinoptix/DisneyBRDF.h @@ -5,10 +5,12 @@ namespace BRDFBasics{ static __inline__ __device__ -float PowerHeuristic(float a, float b) +float PowerHeuristic(float a, float b, float beta = 2.0f) { - //float t = a * a; - return b>10.0f*a?(a/(a + b + 1e-6)) : (a*a/(a*a + b*b + 1e-6)); + float t = pow(a,beta); + float t2 = pow(b, beta); + return t / (t2 + t + 1e-6); + } static __inline__ __device__ float fresnel(float cosT){ float v = clamp(1-cosT,0.0f,1.0f); diff --git a/zenovis/xinxinoptix/PTKernel.cu b/zenovis/xinxinoptix/PTKernel.cu index d07135a268..8141e41c5b 100644 --- a/zenovis/xinxinoptix/PTKernel.cu +++ b/zenovis/xinxinoptix/PTKernel.cu @@ -348,8 +348,6 @@ extern "C" __global__ void __raygen__rg() break; } - //if(prd.depth>prd.max_depth) { - if(prd.depth > prd.max_depth){ float RRprob = max(max(prd.attenuation.x, prd.attenuation.y), prd.attenuation.z); RRprob = min(RRprob, 0.99f); @@ -478,7 +476,7 @@ extern "C" __global__ void __miss__radiance() ); - float misWeight = BRDFBasics::PowerHeuristic(prd->samplePdf,envPdf); + float misWeight = BRDFBasics::PowerHeuristic(prd->samplePdf,envPdf, 1.0f); misWeight = misWeight>0.0f?misWeight:0.0f; misWeight = envPdf>0.0f?misWeight:1.0f; From 73d094f6d3e829ed86666f36027b491425027243 Mon Sep 17 00:00:00 2001 From: iaomw Date: Sun, 29 Sep 2024 14:33:08 +0800 Subject: [PATCH 2/2] improve optix pipeline cache logic --- zenovis/xinxinoptix/OptiXStuff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenovis/xinxinoptix/OptiXStuff.h b/zenovis/xinxinoptix/OptiXStuff.h index f9ba910311..1644843984 100644 --- a/zenovis/xinxinoptix/OptiXStuff.h +++ b/zenovis/xinxinoptix/OptiXStuff.h @@ -154,7 +154,7 @@ inline uint CachedPrimitiveTypeFlags = UINT_MAX; inline bool configPipeline(OptixPrimitiveTypeFlags usesPrimitiveTypeFlags) { - if (usesPrimitiveTypeFlags == CachedPrimitiveTypeFlags) { return false; } + if (CachedPrimitiveTypeFlags != UINT_MAX && (usesPrimitiveTypeFlags&CachedPrimitiveTypeFlags == usesPrimitiveTypeFlags)) { return false; } CachedPrimitiveTypeFlags = usesPrimitiveTypeFlags; pipeline_compile_options = {};