From 89f97a35f39c858fbf270e0a5ee8f49cd11ef6ea Mon Sep 17 00:00:00 2001 From: iaomw Date: Fri, 25 Oct 2024 20:31:13 +0800 Subject: [PATCH] fix ray ending condition --- zenovis/xinxinoptix/DeflMatShader.cu | 2 -- zenovis/xinxinoptix/Light.cu | 2 ++ zenovis/xinxinoptix/PTKernel.cu | 6 +++--- zenovis/xinxinoptix/TraceStuff.h | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/zenovis/xinxinoptix/DeflMatShader.cu b/zenovis/xinxinoptix/DeflMatShader.cu index abe384de71..4fcabf34a4 100644 --- a/zenovis/xinxinoptix/DeflMatShader.cu +++ b/zenovis/xinxinoptix/DeflMatShader.cu @@ -658,8 +658,6 @@ extern "C" __global__ void __closesthit__radiance() } prd->attenuation2 = prd->attenuation; prd->passed = true; - prd->adepth++; - //prd->samplePdf = 0.0f; //you shall pass! prd->radiance = make_float3(0.0f); prd->_tmin_ = optixGetRayTmax(); diff --git a/zenovis/xinxinoptix/Light.cu b/zenovis/xinxinoptix/Light.cu index bc53d54cca..c908ca0969 100644 --- a/zenovis/xinxinoptix/Light.cu +++ b/zenovis/xinxinoptix/Light.cu @@ -282,6 +282,8 @@ extern "C" __global__ void __closesthit__radiance() // if (scatterPDF > __FLT_DENORM_MIN__) { // prd->radiance /= scatterPDF; // } + auto tmp = float3{1, 1, 1}; + prd->updateAttenuation(tmp); } return; } diff --git a/zenovis/xinxinoptix/PTKernel.cu b/zenovis/xinxinoptix/PTKernel.cu index 4ee331326a..71fdb80543 100644 --- a/zenovis/xinxinoptix/PTKernel.cu +++ b/zenovis/xinxinoptix/PTKernel.cu @@ -244,7 +244,7 @@ extern "C" __global__ void __raygen__rg() RadiancePRD prd; prd.pixel_area = cam.height/(float)(h)/(cam.focal_length); - prd.adepth = 0; + prd.emission = make_float3(0.f); prd.radiance = make_float3(0.f); prd.attenuation = make_float3(1.f); @@ -344,11 +344,11 @@ extern "C" __global__ void __raygen__rg() prd.done = true; } - if( prd.done || params.simpleRender==true || prd.adepth>64){ + if( prd.done || prd.depth>prd.max_depth){ break; } - if(prd.depth > prd.max_depth){ + if(prd.depth > 1){ float RRprob = max(max(prd.attenuation.x, prd.attenuation.y), prd.attenuation.z); RRprob = min(RRprob, 0.99f); if(rnd(prd.seed) > RRprob) { diff --git a/zenovis/xinxinoptix/TraceStuff.h b/zenovis/xinxinoptix/TraceStuff.h index d1ee364604..25659fa3d7 100644 --- a/zenovis/xinxinoptix/TraceStuff.h +++ b/zenovis/xinxinoptix/TraceStuff.h @@ -103,7 +103,6 @@ struct RadiancePRD int curMatIdx; float samplePdf; bool fromDiff; - unsigned char adepth; bool alphaHit; vec3 mask_value; vec3 click_pos;