Crafter.Graphics/examples/RTVolume/miss.wgsl
catbot 5dd1086f08 docs(webgpu-rt): add RTVolume example (procedural spheres + any-hit cut-out)
A 3x3x3 grid of AABB-geometry spheres rendered through an analytic
ray-sphere intersection shader, with an any-hit spherical-checkerboard
cut-out so the background shows through. Exercises both features end to
end on the WebGPU wavefront tracer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 22:09:30 +00:00

7 lines
341 B
WebGPU Shading Language

// RTVolume miss (runs in SHADE). Vertical sky gradient — also what shows
// through the any-hit cut-out cells.
fn miss_main(ray: RayDesc, payload: ptr<function, Payload>) {
let t = clamp(ray.direction.y * 0.5 + 0.5, 0.0, 1.0);
rtAccumulate(mix(vec3<f32>(0.05, 0.07, 0.12),
vec3<f32>(0.45, 0.60, 0.85), t));
}