Log inGet started
Package

vol_lights.computeShader

Newest version

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

namekind
scene_depthtexture_depth
frame_cambuffer (@frame.camera)
lightsbuffer (@scene.lights)
shadow_pooltexture_depth (@scene.shadowPool)
vol_paramsbuffer
lights_prevtexture2d (the previous render's half)
length_prevtexture2d (how long each of the previous render's rays was, written by vol_scatter)
lights_statebuffer (the history target's state)
history_outstorage2d (rgba16f)
lights_outstorage2d (rgba16f)