Skip to content

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

License

Notifications You must be signed in to change notification settings

kornelski/bevy_flatland_radiance_cascades

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks