DEV DIARY: CREATING REALISTIC SKY AND CLOUDS
Development Diary: David McFarland, Senior Software Architect
The Golf Club uses physically based simulation of atmospheric scattering to create a realistic looking sky, haze, and clouds.
This post is a brief tour of the system, showing some of the features and the impact they have on the overall look of the game. Everything described here is done in real-time, so the time of day and cloud cover can change smoothly as you play, and react properly as the camera moves through the world.
Time of Day
Here’s how the sky looks on its own at different times of day.
As well as the look of the sky itself, the colour of the light from the sun is also affected by the atmosphere, creating a realistic red tint to the morning or evening sun.
Altitude is also taken into account. The pictures above are all taken from ground level.
This is the same time as sunset, but looking down from the edge of space:
Note that there is no ground here, so all you are seeing is light scattering from the atmosphere.
Haze is configurable to represent a varying amount of moisture and pollution in the air.
This is what different haze densities look like at the same time of day:
Clouds are simulated in a way that’s very similar to haze. The examples here are meant to represent cumulus or stratocumulus clouds.
The way a cloud looks depends greatly on the direction of the sun relative to the viewer. Here are a few examples using the same patch of clouds.
Sunset behind clouds:
Sun directly behind clouds:
Sun behind the viewer:
You can see the strong halo effect when the sun is directly behind the clouds. The clouds cast shadows on themselves and each other based on the direction of the sun.
Cloud density can be changed to allow a smooth transition from clear sky to totally overcast:
Putting it all together
Here’s a shot of our mountain environment without sky, haze, or clouds:
Here it is with everything turned on:
Here it is with more cloud cover (you can see the shadows cast by the clouds on the terrain):
And here is late evening with a clear sky: