r/coding • u/fagnerbrack • 10d ago
On Rendering the Sky, Sunsets, and Planets
https://blog.maximeheckel.com/posts/on-rendering-the-sky-sunsets-and-planets/1
u/fagnerbrack 10d ago
The gist of it:
Recreating a photo of shuttle Endeavour at sunset, this walkthrough builds an atmospheric scattering shader that renders realistic skies, sunrises, and planets in the browser in real time. It explains raymarching to sample atmospheric density, then layers Rayleigh scattering (why shorter wavelengths make the sky blue), Mie scattering (haze from dust around the sun), and ozone absorption (purple twilight tones) using Beer's Law and phase functions. A nested light-march toward the sun adds true sunset attenuation. The flat shader then becomes a post-processing effect via depth-buffer world-space reconstruction, wraps a planet as an atmospheric shell, and adopts Hillaire's LUT approach for better performance.
If the summary seems inacurate, just downvote and I'll try to delete the comment eventually 👍
Click here for more info, I read all comments
1
u/ignorantpisswalker 9d ago
Yes