Skip to content

Commit b7d430f

Browse files
some more refactors to get closer to the "failed_pt_refactor"
1 parent 931e954 commit b7d430f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

examples_tests/22.RaytracedAO/closestHit.comp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ bool get_sample_job(in uint vertex_depth_mod_2)
2727

2828
void main()
2929
{
30+
bool hit = false;
3031
const uint vertex_depth = get_path_vertex_depth();
3132
const uint vertex_depth_mod_2 = vertex_depth&0x1u;
3233
if (get_sample_job(vertex_depth_mod_2))
@@ -39,7 +40,7 @@ void main()
3940

4041
const uint batchInstanceGUID = intersection.shapeid;
4142
const uint invalidID = 0x80000000u;
42-
const bool hit = batchInstanceGUID!=invalidID;
43+
hit = batchInstanceGUID!=invalidID;
4344

4445
const uvec2 outPixelLocation = unpackOutPixelLocation(ray.time);
4546
const vec3 throughput = vec3(
@@ -55,7 +56,7 @@ void main()
5556
const nbl_glsl_ext_Mitsuba_Loader_instance_data_t batchInstanceData = InstData.data[batchInstanceGUID];
5657

5758
// obtain ray incoming direction
58-
normalizedV = -normalize(ray.direction);
59+
normalizedV = -ray.direction;
5960
// clear the hit success flag
6061
intersections[vertex_depth_mod_2].data[gl_GlobalInvocationID.x].shapeid = -1;
6162

@@ -86,7 +87,7 @@ void main()
8687

8788
generate_next_rays(
8889
MAX_RAYS_GENERATED,material,frontfacing,vertex_depth,scramble_start_state,
89-
sampleID,outPixelLocation,hitWorldPos,geomNormal,throughput
90+
sampleID,outPixelLocation,hitWorldPos,throughput
9091
);
9192
}
9293
}

examples_tests/22.RaytracedAO/raygen.comp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ void main()
6565

6666
// generate rays
6767
const uint sampleID = bitfieldExtract(pc.cummon.samplesComputed_depth,0,16);
68-
const vec3 geomNormal = cross(dPdBary[0],dPdBary[1]);
6968
const uint vertex_depth = 1u;
7069
generate_next_rays(
7170
staticViewData.samplesPerPixelPerDispatch,material,frontfacing,vertex_depth,
72-
scramble_start_state,sampleID,outPixelLocation,hitWorldPos,geomNormal,vec3(1.0)
71+
scramble_start_state,sampleID,outPixelLocation,hitWorldPos,vec3(1.0)
7372
);
7473
}
7574

examples_tests/22.RaytracedAO/raytraceCommon.glsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ nbl_glsl_xoroshiro64star_state_t load_aux_vertex_attrs(
217217
void generate_next_rays(
218218
in uint maxRaysToGen, in nbl_glsl_MC_oriented_material_t material, in bool frontfacing, in uint vertex_depth,
219219
in nbl_glsl_xoroshiro64star_state_t scramble_start_state, in uint sampleID, in uvec2 outPixelLocation,
220-
in vec3 origin, vec3 geomNormal, in vec3 prevThroughput)
220+
in vec3 origin, in vec3 prevThroughput)
221221
{
222222
// get material streams as well
223223
const nbl_glsl_MC_instr_stream_t gcs = nbl_glsl_MC_oriented_material_t_getGenChoiceStream(material);
@@ -262,6 +262,7 @@ for (uint i=1u; i!=vertex_depth; i++)
262262
atomicMax(traceIndirect[vertex_depth_mod_2_inv].params.num_groups_x,(baseOutputID+raysToAllocate-1u)/WORKGROUP_SIZE+1u);
263263

264264
// TODO: improve ray offset (maybe using smooth normal wouldn't be a sin)
265+
vec3 geomNormal = cross(dPdBary[0], dPdBary[1]);
265266
const vec3 absGeomNormal = abs(geomNormal);
266267
geomNormal /= max(max(absGeomNormal.x,absGeomNormal.y),absGeomNormal.z)*96.f;
267268
uint offset = 0u;

0 commit comments

Comments
 (0)