Image Image Image Image Image Image Image Image Image Image

The Golf Club | June 2, 2023

Scroll to top

Top

DEV DIARY: CREATING REALISTIC SKY AND CLOUDS

DEV DIARY: CREATING REALISTIC SKY AND CLOUDS
hbdeveloper
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.

Midday:

image2014-1-30 8_53_37

Afternoon:

image2014-1-30 8_54_50

Sunset:

image2014-1-30 8_55_20

Dusk:

image2014-1-30 8_55_39

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

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:

image2014-1-30 9_0_3

Note that there is no ground here, so all you are seeing is light scattering from the atmosphere.

Haze

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:

haze

Clouds

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:

Clouds1

Sun directly behind clouds:

Clouds2

Sun behind the viewer:

Clouds3

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:

density

Putting it all together

Here’s a shot of our mountain environment without sky, haze, or clouds:

nosky

Here it is with everything turned on:

Game1

Here it is with more cloud cover (you can see the shadows cast by the clouds on the terrain):

Game2

And here is late evening with a clear sky:

Game3