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
7
examples/Sponza/resolve.wgsl
Normal file
7
examples/Sponza/resolve.wgsl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// Sponza RESOLVE-stage tonemap: Reinhard + gamma 2.2 over the linear
|
||||
// accumulator — matches the tonemap the megakernel raygen applied inline.
|
||||
fn resolve_main(coord: vec2<u32>, hdr: vec4<f32>) -> vec4<f32> {
|
||||
let mapped = hdr.rgb / (hdr.rgb + vec3<f32>(1.0));
|
||||
let g = pow(mapped, vec3<f32>(1.0 / 2.2));
|
||||
return vec4<f32>(g, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue