Fix stb record offset

Fixes #1018
This commit is contained in:
Sascha Willems 2023-03-24 20:10:54 +01:00
parent 02569bf4ae
commit 5c6cec4a62
4 changed files with 3 additions and 3 deletions

View file

@ -68,7 +68,7 @@ void main()
vec3 origin = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT; vec3 origin = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT;
shadowed = true; shadowed = true;
// Trace shadow ray and offset indices to match shadow hit/miss shader group indices // Trace shadow ray and offset indices to match shadow hit/miss shader group indices
traceRayEXT(topLevelAS, gl_RayFlagsTerminateOnFirstHitEXT | gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT, 0xFF, 1, 0, 1, origin, tmin, lightVector, tmax, 2); traceRayEXT(topLevelAS, gl_RayFlagsTerminateOnFirstHitEXT | gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT, 0xFF, 0, 0, 1, origin, tmin, lightVector, tmax, 2);
if (shadowed) { if (shadowed) {
hitValue *= 0.3; hitValue *= 0.3;
} }

View file

@ -78,7 +78,7 @@ void main(in InPayload inPayload, inout InOutPayload inOutPayload, in float2 att
inOutPayload.shadowed = true; inOutPayload.shadowed = true;
// Offset indices to match shadow hit/miss index // Offset indices to match shadow hit/miss index
TraceRay(topLevelAS, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_FORCE_OPAQUE | RAY_FLAG_SKIP_CLOSEST_HIT_SHADER, 0xff, 1, 0, 1, rayDesc, inOutPayload); TraceRay(topLevelAS, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_FORCE_OPAQUE | RAY_FLAG_SKIP_CLOSEST_HIT_SHADER, 0xff, 0, 0, 1, rayDesc, inOutPayload);
if (inOutPayload.shadowed) { if (inOutPayload.shadowed) {
inPayload.hitValue *= 0.3; inPayload.hitValue *= 0.3;
} }