Skip to content

Commit 931e954

Browse files
use geom normal for offsets
1 parent f21ca6a commit 931e954

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples_tests/22.RaytracedAO/raytraceCommon.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,13 @@ for (uint i=1u; i!=vertex_depth; i++)
263263

264264
// TODO: improve ray offset (maybe using smooth normal wouldn't be a sin)
265265
const vec3 absGeomNormal = abs(geomNormal);
266-
geomNormal /= max(max(absGeomNormal.x,absGeomNormal.y),absGeomNormal.z);
266+
geomNormal /= max(max(absGeomNormal.x,absGeomNormal.y),absGeomNormal.z)*96.f;
267267
uint offset = 0u;
268268
for (uint i=0u; i<maxRaysToGen; i++)
269269
if (maxT[i]!=0.f)
270270
{
271271
nbl_glsl_ext_RadeonRays_ray newRay;
272-
newRay.origin = origin+uintBitsToFloat(floatBitsToUint(direction[i])^floatBitsToUint(dot(geomNormal,direction[i]))&0x80000000u)/96.f;
272+
newRay.origin = origin+uintBitsToFloat(floatBitsToUint(geomNormal)^floatBitsToUint(dot(geomNormal,direction[i]))&0x80000000u);
273273
newRay.maxT = maxT[i];
274274
newRay.direction = direction[i];
275275
newRay.time = packOutPixelLocation(outPixelLocation);

0 commit comments

Comments
 (0)