Builtin Library
- ..
- README.md1.1 KB
- bindings.yaml396 B
- shader.wgsl12.1 KB
README.md
contact_shadows
Traces a short ray through the depth buffer per pixel toward the lights reaching it, so contact between two surfaces reads as a hard nearby shadow the shadow map is too coarse to hold.
The sun's direction and the trace settings arrive in contact_params; the scene's other lights arrive in contact_lights, three vec4s each — (position, radius), (direction, coneOuterCos), (intensity, coneInnerCos, kind, luminance), with kind 0 distant, 1 point, 2 spot. Every light in that pool is weighed at the pixel by its intensity, colour luminance and N·L, and a local light's also by its attenuation and cone; the maxTracedLights heaviest are marched toward, so a pixel darkens by the share of its light the traces found blocked. A local light's ray stops at the light itself.
Bindings
| name | kind |
|---|---|
scene_depth | texture_depth |
scene_normal | texture2d |
frame_cam | buffer |
contact_params | buffer |
contact_lights | buffer |
contact_out | storage2d (rgba8) |