Skip to content

Commit

Permalink
pick
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhang95 committed Dec 3, 2024
1 parent 6e80b9e commit 0b9c0f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 0 additions & 1 deletion zenovis/xinxinoptix/DeflMatShader.cu
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ extern "C" __global__ void __closesthit__radiance()
//MatOutput mats = evalMaterial(rt_data->textures, rt_data->uniforms, attrs);
MatOutput mats = optixDirectCall<MatOutput, cudaTextureObject_t[], float4*, const MatInput&>( rt_data->dc_index, rt_data->textures, rt_data->uniforms, attrs );
prd->mask_value = mats.mask_value;
prd->click_pos = P;

if (prd->test_distance) {

Expand Down
24 changes: 20 additions & 4 deletions zenovis/xinxinoptix/PTKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ extern "C" __global__ void __raygen__rg()
float3 tmp_normal{};
unsigned int sobolseed = subframe_index;
float3 mask_value = make_float3( 0.0f );
float3 click_pos = make_float3( 0.0f );

do{
// The center of each pixel is at fraction (0.5,0.5)
Expand Down Expand Up @@ -263,7 +262,6 @@ extern "C" __global__ void __raygen__rg()
prd.direction = ray_direction;
prd.samplePdf = 1.0f;
prd.mask_value = make_float3( 0.0f );
prd.click_pos = make_float3( 0.0f );

prd.depth = 0;
prd.diffDepth = 0;
Expand All @@ -289,8 +287,27 @@ extern "C" __global__ void __raygen__rg()
unsigned char background_trace = 0;
prd.alphaHit = false;

if (subframe_index == 0) {
RadiancePRD testPRD {};
testPRD.done = false;
testPRD.seed = seed;
testPRD.depth == 0;
testPRD._tmin_ = 0;
testPRD.maxDistance = FLT_MAX;
testPRD.test_distance = true;

uint8_t test_mask = EverythingMask ^ VolumeMatMask;
do {
traceRadiance(params.handle, ray_origin, ray_direction, testPRD._tmin_, testPRD.maxDistance, &testPRD, test_mask);
} while(testPRD.test_distance && !testPRD.done);
float3 click_pos = make_float3( 0.0f );
if (testPRD.maxDistance < FLT_MAX) {
click_pos = ray_origin + ray_direction * testPRD.maxDistance;
}
params.frame_buffer_P[ image_index ] = float3_to_half3(click_pos);
}

traceRadiance(params.handle, ray_origin, ray_direction, _tmin_, prd.maxDistance, &prd, _mask_);
click_pos = prd.click_pos;
float3 m = prd.mask_value;
mask_value = mask_value + m;

Expand Down Expand Up @@ -436,7 +453,6 @@ extern "C" __global__ void __raygen__rg()
params.accum_buffer_B[ image_index ] = float_to_half(accum_color_b.x);

params.frame_buffer_M[ image_index ] = float3_to_half3(accum_mask);
params.frame_buffer_P[ image_index ] = float3_to_half3(click_pos);

auto uv = float2{idx.x+0.5f, idx.y+0.5f};
auto dither = InterleavedGradientNoise(uv);
Expand Down
1 change: 0 additions & 1 deletion zenovis/xinxinoptix/TraceStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ struct RadiancePRD
bool fromDiff;
bool alphaHit;
vec3 mask_value;
vec3 click_pos;
unsigned char max_depth;

uint16_t lightmask = EverythingMask;
Expand Down

0 comments on commit 0b9c0f7

Please sign in to comment.