contact_shadows.computeShader
- README.md1.1 KB
- bindings.yaml396 B
- shader.wgsl11.2 KB
This package holds more than this page lists. See all of its files in its world.
README.md
contact_shadows
Traces a short ray through the depth buffer per pixel toward the point, spot and distant 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 contact is contact_shadows_sun's.
The trace settings arrive in contact_params; the 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) |