[[vk::binding(11, 0)]] RaytracingAccelerationStructure tlas;
static const float RASTER_SHADOW_EPS = 0.002;
bool traceShadowOccluded(float3 origin, float3 direction, float tMin, float tMax)
{
RayDesc ray;
ray.Origin = origin;
ray.Direction = direction;
ray.TMin = tMin;
ray.TMax = tMax;
RayQuery<RAY_FLAG_NONE> q;
q.TraceRayInline(
tlas,
RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH, // Optimization: any hit is enough to shadow
0xFF,
ray
);
while (q.Proceed()) {
// q.Proceed() steps through potential hits.
// For simple opaque shadows, we don't need logic here.
}
return (q.CommittedStatus() == COMMITTED_TRIANGLE_HIT);
}