vol_lights.computeShader
- README.md1.8 KB
- bindings.yaml1.0 KB
- shader.wgsl14.7 KB
This package holds more than this page lists. See all of its files in its world.
README.md
vol_lights
Marches the view rays vol_scatter marches for the scene's lights that stand
somewhere (point, spot, rect), accumulating the light they scatter toward the
camera through the same medium and at the same samples.
A light lights nothing past its radius, so the work follows the light that reaches the medium:
- each 8x8 tile of rays gathers the lights whose reach meets the cone its rays fill, once for the whole tile;
- each ray keeps the tile's lights whose reach it crosses, and marches only the stretch between the first place one of them reaches and the last, starting from the transmittance the medium holds there (the density falls off exponentially with altitude, so the medium crossed before a sample is a geometric series in closed form);
- each sample takes a light only where its radius reaches it, shadowed from it
by the shadow pages the surfaces are shadowed by
(
@builtin::shaderModules.light_shadows), so a lamp lights no air on the far side of a wall.
A ray no light reaches marches nothing. Consecutive renders of a view share the
samples the way vol_scatter's do.
Includes
scattering_common@builtin::shaderModules.light_shadows
Bindings
| name | kind |
|---|---|
scene_depth | texture_depth |
frame_cam | buffer (@frame.camera) |
lights | buffer (@scene.lights) |
shadow_pool | texture_depth (@scene.shadowPool) |
vol_params | buffer |
lights_prev | texture2d (the previous render's half) |
length_prev | texture2d (how long each of the previous render's rays was, written by vol_scatter) |
lights_state | buffer (the history target's state) |
history_out | storage2d (rgba16f) |
lights_out | storage2d (rgba16f) |