Skip to content

Commit 0704cd5

Browse files
normalizedV or normalizedN are wrong
1 parent cbd023c commit 0704cd5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

examples_tests/22.RaytracedAO/raygen.comp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ bool gen_sample_ray(
9999
nbl_glsl_LightSample s;
100100
throughput = nbl_glsl_MC_runGenerateAndRemainderStream(precomp, gcs, rnps, rand, pdf, s);
101101
throughput /= float(staticViewData.samplesPerPixelPerDispatch);
102-
return true;
102+
103+
direction = s.L;
104+
105+
return s.NdotL>FLT_MIN && any(greaterThan(throughput,vec3(FLT_MIN)));
103106
}
104107

105108
void main()
@@ -128,7 +131,7 @@ void main()
128131
// tmp gbuffer reads
129132
const vec2 normalBuffer = texelFetch(encodedNormal,pixelCoord,0).rg;
130133
const vec2 UV = texelFetch(uvCoords,pixelCoord,0).xy;
131-
mat2 dUVdScreen;/*
134+
mat2 dUVdScreen = mat2(0.0,0.0,0.0,0.0);/*
132135
mat2x3 dBarydScreen;/*
133136
{
134137
// TODO: future https://diaryofagraphicsprogrammer.blogspot.com/2018/03/triangle-visibility-buffer.html
@@ -215,7 +218,7 @@ void main()
215218
const uint realOutputID = outputID+i;
216219
if (validRay)
217220
{
218-
const float err = 1.0/512.0;
221+
const float err = 1.0/64.0;
219222
rays[realOutputID].origin = worldPosition+direction*err;
220223
rays[realOutputID].maxT = max(maxT-err,0.0);
221224
rays[realOutputID].direction = direction;

examples_tests/22.RaytracedAO/resolve.comp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ void main()
3030
if (hit.shapeid<0)
3131
continue;
3232

33-
// TODO: fetch from ray buffer
34-
const float thoughput = 1.0/7.0;
33+
const vec3 thoughput = vec3(unpackHalf2x16(rays[rayID].useless_padding).yx,unpackHalf2x16(rays[rayID].backfaceCulling).yx);
3534

3635
const bool frontface = true; // TODO: how to determine frontface easily from radeon rays!? barycentrics? ray direction vs. oriented cross product?
3736
nbl_glsl_MC_oriented_material_t material = nbl_glsl_MC_material_data_t_getOriented(InstData.data[hit.shapeid].material,frontface);

0 commit comments

Comments
 (0)