bevy_flatland_radiance_cascades

Learning Bevy compute shaders by poorly implementing 2D Radiance Cascades algorithm for global illumination

CC0-1.0 License

Stars
11

Flatland Radiance Cascades

Simulates lights in 2D scenes, with soft shadows. It's a very unpolished implementation in Rust/Bevy.

It's based on the radiance cascades paper, but with a much improved storage layout:

  • It uses pre-averaging, so that results of tracing of individual rays don't need to be stored, and cascades store only merged average of a cone needed for the next cascade.
  • It uses direction-first storage to be able to merge probes using hardware filtering (the hw part is not implemented yet).

See src/cascades.rs and assets/radiance_cascades.wgsl.

This implementation is different than most other examples:

  • It uses a "gear fix" workaround to reduce halos at the seams between cascades (instead of "bilinear fix").
  • It uses a 2x scaling factor for the lenghts of cascades and the number of rays (most use much more expensive 4x scaling).
  • It doesn't use SDFs (it naively marches density map).
  • it doesn't use mipmaps (yet).
  • There's no bounce light implemented yet.

Links