The SilverLining Sky, Cloud, and Weather SDK offers a lot of control over the types, positions, and quantity of clouds in your virtual environment. But, sometimes it feels like you need a degree in meteorology to know how to set up something as simple as “party cloudy” conditions in a realistic manner. This article aims to de-mystify the process of creating cloud conditions to represent more general weather conditions, such as those found in feeds from NOAA. The easiest thing is to just use our AtmosphericConditions::SetPresetConditions() method, but you may need to simulate conditions not covered by that method.
Let’s start with fair conditions, and work our way up to storms. For fair skies, we just add a cirrus cloud layer with a base altitude of 8 km, and a length and width of 100 km. If your viewpoints tend to be near the ground, you may want to enable the “infinite” flag on the layer to prevent the cloud from disappearing as the viewer moves. Cirrocumulus would be another valid choice of cloud layer with similar configuration, but these clouds tend to foretell worsening weather is approaching.
From a meteorological standpoint, cumulus mediocris clouds are the right choice for these conditions. But, we prefer the look of SilverLining’s cumulus congestus clouds. This scene shows a CUMULUS_CONGESTUS_HI_RES cloud layer, with a density of 0.3, base altitude of 4 km, length and width of 100km, and a thickness of 500 meters. Remember the “thickness” of cumulus cloud layers in SilverLining actually defines the variation in the base altitudes of individual clouds; the actual height of each cloud is determined only by the physical simulation of each cloud’s growth.
We like to always enable CloudLayer::SetFadeTowardEdges() to ensure the clouds fade out in the distance, and CloudLayer::SetCurveTowardGround() can help cloud layers look larger than they really are. For a softer look, you might also call CloudLayer::SetAlpha(0.7), although this image was taken with no extra alpha blending specified.
There are a couple of approaches to “mostly cloudy” conditions. One is to use the same approach as partly cloudy, using cumulus congestus clouds – just a lot more of them. This first image shows a cumulus congestus layer with density of 1.0 and a base altitude of 3km. Note that we’re lowering the cloud altitudes as conditions worsen, and adding more of them. It’s possible to even overdrive the density of cumulus clouds by specifying density values greater than 1.0, but this can lead to overlapping clouds that may cause sorting artifacts at runtime. These too are the new “high resolution” cumulus clouds introduced in SilverLining 3.0.
Another approach is to set up identical conditions with a stratocumulus cloud layer. This would be the more correct thing to do, and as you can see in this second screenshot it actually looks more convincing as well. The decision on whether to use stratocumulus really depends on your application’s system requirements. Stratocumulus clouds are drawn using a technique called GPU ray-casting, and it is very demanding on the fragment processor of your GPU. Older systems may have a hard time with it, but if you don’t support older systems anyhow, stratocumulus will yield higher quality results for mostly cloudy conditions.
Another thing to consider is that GPU ray-casting doesn’t handle the case of the camera being inside the clouds as well as the “splatting” approach used by cumulus congestus clouds. If you are building a flight simulator and the experience of flying through the clouds is important, cumulus congestus is probably the better choice for mostly cloudy.
Overcast conditions are really simple – just set up a stratus cloud layer at around 1km height, with 1.0 density. Be sure SetFadeTowardEdges() is on to ensure a good blend with the sky at the cloud’s edge. Add some rain, sleet, or snow with CloudLayer::SetPrecipitation() to complete the effect.
Here’s where things get fun. An unstable atmosphere may be represented with a combination of several cloud types in SilverLining. In this scene, we’ve combined:
- A cumulus congestus layer at 3km altitude and 0.8 density
- A towering cumulus layer at 3km altitude and 0.2 density
- A cumulonimbus layer at 700m altitude, and a thickness, width, and length of 7km
Basically these different cloud types represent cumulus clouds at various stages along the way of turning into a thunderstorm. Cumulus congestus are heavy, moisture-laden cumulus clouds. Towering cumulus are cumulus clouds that are starting to see some upward convection and aggressively growing vertically. And, cumulonimbus are actual anvil-shaped thunderheads with lightning effects.
Remember cumulonimbus cloud layers in SilverLining represent one single cumulonimbus cloud. This allows you to easily position individual thunderheads to represent squall lines and things of that effect. And, unlike other cumulus cloud layers, the “thickness” parameter on cumulonimbus represents the actual height of the cloud. In hindsight, I may have gone closer to 10km on the size of the cumulonimbus cloud in this scene to make it even more dramatic.
Towering cumulus clouds should be used sparingly; the 0.2 density used here seems to look about right. You only really notice them from viewpoints above the clouds, such as this one. If your camera is always on the ground, you might not need to incur the cost of these clouds at all, since they won’t look much different than cumulus congestus from below.
Of course these are just examples of some cloud conditions we’ve found that seem to look good. Feel free to experiment, and create an infinite variety of weather conditions in your application!