← Back to Blogs
HN Story

The Art and Science of Rendering Atmospheric Scattering

May 13, 2026

The Art and Science of Rendering Atmospheric Scattering

Rendering a believable sky is one of the most challenging tasks in computer graphics. While many developers rely on "graphics hacks"—such as stacking multiple linear gradients or using static skyboxes—these methods fail to capture the dynamic, shifting nature of light as it interacts with a planetary atmosphere. To achieve true realism, one must move from artistic approximation to physics-based simulation.

Recent work by Maxime Heckel highlights the intricate process of rendering skies, sunsets, and planets by simulating atmospheric scattering. This approach doesn't just "paint" a sky; it calculates how light travels through a medium, providing a foundation for everything from the deep blue of a midday sky to the fiery hues of a sunset.

The Physics of the Sky: Scattering and Absorption

At the heart of realistic sky rendering is the concept of atmospheric scattering. When sunlight enters a planet's atmosphere, it collides with molecules and particles, causing the light to scatter in different directions. This is not a uniform process; different wavelengths of light scatter differently.

Rayleigh and Mie Scattering

Two primary types of scattering define the visual experience of a sky:

  1. Rayleigh Scattering: This occurs when light hits particles much smaller than the wavelength of the light (such as nitrogen and oxygen molecules). It affects shorter wavelengths (blue) more than longer wavelengths (red), which is why the sky appears blue during the day.
  2. Mie Scattering: This occurs when light hits larger particles (such as dust, pollen, or water droplets). Mie scattering is less wavelength-dependent and tends to scatter light forward, creating the bright "halo" or glow around the sun.

By simulating these two phenomena, developers can create a dynamic system where the color of the sky shifts automatically based on the sun's angle relative to the observer.

From Theory to Implementation

Implementing these models requires a transition from simple 2D rendering to volumetric calculations. While some developers have attempted to use layered gradients, the community consensus is that physics-based models are vastly superior for dynamic environments.

The Evolution of Sky Models

The field has a rich history of research. Some of the foundational work includes:

  • The Nishita Model (1993): Often cited as the "OG" paper on the topic, "Display of The Earth Taking into Account Atmospheric Scattering" laid the groundwork for simulating the Earth's atmosphere.
  • Perez and Preetham Models: These are widely used all-weather sky models that provide a balance between computational efficiency and visual accuracy.
  • Modern Analytic Models: Recent advancements allow for full spectral sky-dome radiance, enabling developers to create Godot plugins or custom engines that move beyond static assets.

Challenges and Refinements

Even with a robust physics model, achieving total realism requires addressing specific edge cases and atmospheric nuances.

The Twilight Problem

One critical detail often missed in simplified scattering models is the transition to night. As noted by community contributors, the sky should not turn black the instant the sun dips below the horizon. In reality, the sun continues to illuminate the upper atmosphere long after it has set for the observer on the ground. This "twilight" period persists until the sun is approximately 18 degrees below the horizon.

Expanding the Horizon

For those looking to push the boundaries of atmospheric rendering, the next steps often involve integrating other volumetric effects:

  • Volumetric Clouds: Combining scattering with cloud rendering creates the dramatic, light-streaked sunsets seen in high-end simulations.
  • Subsurface Scattering: The principles of atmospheric scattering are closely related to how light penetrates other mediums, such as milk or skin (BSSRDF), which is essential for rendering organic materials.
  • Liquid Interaction: Extending these models to include liquid oceans—incorporating absorption and reflection—creates a cohesive planetary environment.

Conclusion

Whether for a planetarium app on Vision Pro, a procedural space generator, or a web-based experiment, the shift toward physics-based rendering transforms the sky from a background image into a living system. As hardware capabilities in browsers and mobile devices continue to grow, the barrier to implementing these complex mathematical models continues to drop, allowing more developers to bring the beauty of the cosmos to their screens.

References

HN Stories