Systems / Graphics Programming Project
View Github Page →This project explores the implementation of a physically inspired atmospheric scattering shader designed for real-time applications. The shader simulates Rayleigh and Mie scattering using volumetric raymarching, with performance optimizations that make it suitable for planetary-scale scenes.
Atmospheric appearance is driven by how light scatters through particles in the air. Rayleigh scattering affects wavelength-dependent color, while Mie scattering contributes to brightness and glow around light sources. By controlling scattering coefficients directly, the shader balances physical plausibility with artistic control.
The shader evaluates atmospheric scattering by raymarching along the camera’s view direction, approximating otherwise expensive nested integrals with a finite number of samples. This approach focuses computation only on light that actually reaches the camera, making real-time execution feasible.
To eliminate costly nested loops, the shader leverages a precomputed optical depth texture. This texture encodes light attenuation based on altitude and sun angle, allowing the shader to replace repeated calculations with efficient texture lookups and achieve significant performance gains.
Planned improvements include rendering the effect at reduced resolution with upscaling, further optimizing performance. Additional goals involve integrating volumetric cloud rendering and exploring stylized post-processing effects built on top of the scattering results.
A detailed breakdown of the algorithm design, implementation challenges, and optimization process is available in the full article below.
Read the full technical article →