Crafter.Graphics/examples/Sponza/miss.wgsl

12 lines
499 B
WebGPU Shading Language
Raw Permalink Normal View History

// Sponza miss (runs in SHADE). Primary miss → two-stop sky gradient.
// Shadow miss → the sun is unoccluded, so add the pending direct term.
2026-05-19 00:27:09 +02:00
fn miss_main(ray: RayDesc, payload: ptr<function, Payload>) {
if ((*payload).shadowRay == 1u) {
rtAccumulate((*payload).color);
2026-05-19 00:27:09 +02:00
return;
}
let t = clamp(ray.direction.y * 0.5 + 0.5, 0.0, 1.0);
let sky = vec3<f32>(0.45, 0.65, 0.95);
let zenith = vec3<f32>(0.95, 0.85, 0.65);
rtAccumulate(mix(sky, zenith, t));
2026-05-19 00:27:09 +02:00
}