diff --git a/zenovis/xinxinoptix/DeflMatShader.cu b/zenovis/xinxinoptix/DeflMatShader.cu index 0735a8422e..d7ecfc7f87 100644 --- a/zenovis/xinxinoptix/DeflMatShader.cu +++ b/zenovis/xinxinoptix/DeflMatShader.cu @@ -1087,7 +1087,7 @@ extern "C" __global__ void __closesthit__radiance() } } else { float env_weight_sum = 1e-8f; - int NSamples = prd->depth<=2?1:1;//16 / pow(4.0f, (float)prd->depth-1); + int NSamples = prd->depth==1?5:1;//16 / pow(4.0f, (float)prd->depth-1); for(int samples=0;samples0.0f?misWeight:0.0f; - prd->radiance += 1.0f / (float)NSamples * + misWeight = ffPdf>1e-5f?misWeight:1.0f; + misWeight = (ffPdf<0.1||envpdf<0.1)?misWeight:1.0f; + float add = ffPdf>1e-5f?1.0f:0.0f; + prd->radiance += add * misWeight * 1.0f / (float)NSamples * light_attenuation / envpdf * 2.0f * (thin > 0.5f ? float3(mat2.reflectance) : lbrdf); } prd->radiance = float3(clamp(vec3(prd->radiance), vec3(0.0f), vec3(100.0f))); diff --git a/zenovis/xinxinoptix/PTKernel.cu b/zenovis/xinxinoptix/PTKernel.cu index 012365a0fe..d3a6e0e51a 100644 --- a/zenovis/xinxinoptix/PTKernel.cu +++ b/zenovis/xinxinoptix/PTKernel.cu @@ -268,12 +268,14 @@ extern "C" __global__ void __miss__radiance() params.elapsedTime, envPdf, upperBound, - 1.0 + 0.0 ); float misWeight = BRDFBasics::PowerHeuristic(prd->samplePdf,envPdf); misWeight = misWeight>0.0f?misWeight:0.0f; - prd->radiance = skysample ; + misWeight = prd->depth>=1?misWeight:1.0f; + misWeight = (prd->samplePdf<0.25f||envPdf<0.25f)?misWeight:1.0f; + prd->radiance = misWeight * skysample ; prd->done = true; return; }