Crafter.Graphics/examples/RayQueryPick/miss.wgsl
catbot b645746c8c test(webgpu-rt): RayQueryPick example exercising the rayQuery TLAS shim (#25)
Adds an 8^3 = 512-instance TLAS pick test that shoots one analytically
determined ray through a rayQuery=true PlainComputeShader and checks the
read-back committed hit (customIndex 484, t 40.75). 512 instances sit in
the < 8193 regime that the hardcoded 16384-leaf start used to miss, so the
example fails fast if the shim regresses. Verified in Firefox/WebGPU:
"[RayQueryPick] PASS".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 13:33:04 +00:00

11 lines
474 B
WebGPU Shading Language

// RTStress miss (runs in SHADE). Primary miss → sky gradient. Shadow miss
// → the sun is unoccluded, so add the pending direct contribution.
fn miss_main(ray: RayDesc, payload: ptr<function, Payload>) {
if ((*payload).shadowRay == 1u) {
rtAccumulate((*payload).color);
return;
}
let t = clamp(ray.direction.y * 0.5 + 0.5, 0.0, 1.0);
rtAccumulate(mix(vec3<f32>(0.50, 0.62, 0.85),
vec3<f32>(0.90, 0.94, 1.00), t));
}