We have discussed Terrain Generation in other threads, but a nice-looking landscape needs an atmosphere too.
Thrive needs a renderer for the sky and atmosphere, including clouds, fog and potentially weather. Lately I have been putting some effort to make this true, so I’m creating this thread to keep trace of the process and hear about your opinions, including game design ones.
The prototype
My first PR was focused on making a ray marcher work to generate good-looking clouds, which resulted in this:
Then, I worked on making the sky look less gray.
And with different atmospheric composition. For example, the next one has the same composition, pressure and temperature of Titan:
And this has the same composition as Venus:
In all these examples the clouds are made of water, so they all look like terrestrial clouds.
Clouds
The renderer is inside a CompositorEffect applied to a WorldEnvironment instance at the Post-Transparent stage in a compute shader.
The clouds are rendered in a thin shell around a spherical geometry (e.g. a planet). This allow for future seamless generalisation to the space stages without much struggle, but it requires the planet’s radius as an extra parameter.
I’m currently planning to also support rendering on curvature-zero planets (flat) in order to avoid the planet radius in the earliest macroscopic stages.
Sky
The sky is currently rendered by simulating Rayleigh scattering, based on the gaseous atmospheric composition. This way, the sky colour doesn’t have to be hard-coded, and it will be physically realistic only by defining what gases are in the atmosphere. Also, based on the angle of view wrt the horizon and the parent star, and occlusion, other effects naturally arise, like day/night cycles and basic sunset colours.
Rayleigh scattering is the scattering arising by the interaction of the optical electromagnetic radiation with particles much smaller than the light wavelength (e.g. atoms, gas molecules).
Mie scattering (TODO)
Mie scattering will be a factor in both the cloud and the sky renderers. Mie scattering happens when the light hits a homogeneous sphere. This happens when the light scatters around a particle bigger than its wavelength. For example, this is the case of water particles in clouds and smoke. True Mie scattering is currently unimplemented, but in some atmospheres like on Venus it’s crucial for determining the colour of the sky. On Earth, it becomes visible during sunset through thin clouds (red clouds) and it’s responsible for the red skies during extreme wildfires.
Weather (TODO)
I’d also like to discuss how weather should work in Thrive. Maybe it’s better if it has its own thread, but it’s pretty important to discuss it here to simulate fog, for example.
Fog hasn’t been implemented yet, but I think it could be a cool visual effect to have.
Atmospheric perspective (TODO)
Distant objects look fainter and “bluer” (on Earth). This is due to the Beer-Lambert law, which absorbs straight light rays in a quantity proportional to the distance traveled, so distant objects will fade through the Rayleigh radiation.
This can be useful for many reasons, for example to hide artifacts from distant LODs, better-looking graphics and to extinguish the ray-marcher early and avoid wasting compute.
Plus, it looks good:
Overall, I’d like to have this thread to discuss my ideas, your ideas, and technical details, plus share performance and the next milestones.





