webgpu sponza
This commit is contained in:
parent
5553ded476
commit
b5d0f52da0
21 changed files with 1426 additions and 58 deletions
16
examples/Sponza/miss.wgsl
Normal file
16
examples/Sponza/miss.wgsl
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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);
|
||||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue