Planet Rendering: Atmosphere

Published October 18, 2023
Advertisement

I've been working a lot recently on improving the graphics of my planet simulator. In addition to terrain texturing, water rendering, screen space reflections, and cascaded shadow maps, I most recently have added realistic atmosphere rendering using this approach from Epic Games.

It uses a few different lookup table textures and ray marching in the pixel shader. This works for atmospheres of arbitrary thickness and composition. It also works for camera viewpoints at any altitude, from surface to space. Compared to the paper, I made some changes:

  • Altered the parameterization of the sky view lookup table so that the horizon is always centered vertically in image, whereas the paper has the horizon shift downward with increasing altitude, outside the sweet spot of the quadratic warping. My change substantially improves resolution at the horizon at higher altitudes and makes the transition to ray marching outside the atmosphere not visible, whereas the paper's approach shows significant aliasing on the horizon at high altitudes.
  • I didn't implement the 3D aerial perspective lookup table, and instead I'm just doing ray marching against the depth buffer to determine transmittance for opaque objects. This is probably slower than the 3D LUT, but the LUT is lower quality and has limited depth range.

In addition to the atmosphere, I also model how the light from the star shining on the terrain is attenuated through the atmosphere, turning it yellow orange at sunset due to the large distance the light travels through the atmosphere. At noon there is much less attenuation and the star+light appears white. On a Titan-like planet with dense atmosphere, the sun is a deep red and the light is dim. This is all done procedurally at runtime without any special tricks (most games would just change the light color directly according to time of day, but this would be less accurate).

The following screenshot shows a sunset on an earth-like planet with an atmosphere 3x thicker than earth's, at an altitude of around 20km.

This space view is for a planet with a huge 3000km thick atmosphere.

4 likes 1 comments

Comments

Josh Klint

Very interesting…

October 25, 2023 04:12 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement