Ray Sweep

  • 1 min read
Ray Sweep: coloured light paths bouncing around a grid of reflective circles.

Ray Sweep is a physically-based spectral renderer for light transport in two dimensions. It traces rays from the light sources and draws each ray's path into the frame buffer. Every bounce, refraction and reflection is visible as a stroke of light.

Each ray carries a spectral power distribution that can be used in shaders to implement physical based effects, for example, wavelength dependent refraction.

Ray Sweep: white light refacted, according to wavelengths showing a rainbow pattern.

Tech

  • Rust
  • nalgebra — 2D geometry and linear algebra
  • ndarray + rayon — parallel image buffers
  • image / imageproc — rasterisation (Bresenham line drawing)
  • CIE colour-matching functions — spectral-to-sRGB colour science