WebGPU RT: port Sponza to wavefront (shadow ray in SHADE)
Restructure Sponza for the wavefront model: raygen emits the primary ray; closesthit (in SHADE) gathers albedo/normal, accumulates ambient, and emits a shadow ray carrying the pending direct term; miss adds the sky (primary) or the direct term (shadow miss). resolve.wgsl applies the same Reinhard+gamma the megakernel raygen did inline. User bindings moved to group 3 (groups 0..2 reserved). RTPass maxDepth=2. Renders the atrium correctly through the wavefront pipeline (textures, two-sided shading, sun+ambient, shadows, tonemap). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1d2e12dbc9
commit
376e66aeed
6 changed files with 70 additions and 134 deletions
|
|
@ -1,16 +1,12 @@
|
|||
// Sponza miss (runs in SHADE). Primary miss → two-stop sky gradient.
|
||||
// Shadow miss → the sun is unoccluded, so add the pending direct term.
|
||||
fn miss_main(ray: RayDesc, payload: ptr<function, Payload>) {
|
||||
if ((*payload).shadowRay == 1u) {
|
||||
// Shadow ray escaped to infinity — the sun is visible from the
|
||||
// origin, so the surface there should pick up full direct light.
|
||||
// raygen reads color.x as the visibility coefficient.
|
||||
(*payload).color = vec3<f32>(1.0);
|
||||
rtAccumulate((*payload).color);
|
||||
return;
|
||||
}
|
||||
|
||||
// Primary miss: cheap two-stop sky gradient. (*payload).hit stays 0
|
||||
// so raygen knows to skip the lighting path and just use this color.
|
||||
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);
|
||||
(*payload).color = mix(sky, zenith, t);
|
||||
rtAccumulate(mix(sky, zenith, t));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue