Skip to content

Commit

Permalink
fix ray ending condition
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw committed Oct 25, 2024
1 parent 92a76ce commit b1903a0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 0 additions & 2 deletions zenovis/xinxinoptix/DeflMatShader.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions zenovis/xinxinoptix/Light.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions zenovis/xinxinoptix/PTKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion zenovis/xinxinoptix/TraceStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ struct RadiancePRD
int curMatIdx;
float samplePdf;
bool fromDiff;
unsigned char adepth;
bool alphaHit;
vec3 mask_value;
vec3 click_pos;
Expand Down

0 comments on commit b1903a0

Please sign in to comment.