Guides
Clouds and weather
The clouds are a world-space slab at a real altitude, marched from wherever the camera is. A handful of weather parameters shape them, and every one of them eases, so the weather can change while you watch.
applyPreset('overcast') and then applyPreset('storm') on a running sky. Coverage, density, precipitation, the sun colour and the ambient light all ease together.#Cloud forms
cloudForm picks the cloud's shape. The other parameters shape it further.
cloudForm | What it looks like | Presets |
|---|---|---|
cumulus | Fair-weather puffs to full decks, depending on humidity | clear, marine, overcast, storm, night |
altocumulus | Small mid-level puffs in rows: a mackerel sky | altocumulus, sunset |
towering | Cumulus congestus: isolated cauliflower towers | towering, golden |
cirrus | High fibrous ice cloud; the dome stays blue | cirrus |
noctilucent | Electric-blue high cloud lit after sunset | noctilucent |
cumulonimbus | One monumental cell anchored at (0, −9.5 km) | cumulonimbus |
toweringaltocumulus#The weather dials
All of these are 0–1 unless noted and ease when set through setParams or applyPreset.
| Param | Default | Effect |
|---|---|---|
humidity | 0.5 | Cloud cover and the amount of cirrus |
coverage | 0 | Extra cover on top of humidity (−1 … 1) |
precipitation | 0 | Dark bases, rain veils, gloom; lightning above 0.4 |
temperature | 0.45 | Base altitude and vertical growth |
density | 0.55 | Extinction: thin wisps to solid towers |
edge | 0.58 | Erosion strength: soft edges to crisp edges |
clump | 0.5 | Weather map: km-scale clumps and clearings |
wind | 0.35 | Drift speed |
windDirection | 293 | World azimuth the clouds drift toward (degrees) |
cirrus | 1 | Cirrus multiplier (0 – 2) |
haze | 0.14 | Aerosol: milkier sky, redder sunsets, hazier distance |
// a building afternoon storm
sky.setParams({ humidity: 0.85, temperature: 0.7, precipitation: 0.55, wind: 0.6 });The full list, including exposure and post-pass dials, is on Sky parameters.
#Rain and lightning
When precipitation rises past about 0.4, the deck darkens and rain veils hang under it. Lightning then flashes inside the cloud. sky.lightning reports the current flash (0 – 1.5), so you can flash your own lights with it. Set lightning: 0 to turn the flashes off.
storm: a squall line with rain veils and in-cloud lightning, and the low sun under the deck.renderer.setAnimationLoop(() => {
sky.update(dt);
lampLight.intensity = base + sky.lightning * 40; // your own light reacts to the flash
renderer.render(scene, camera);
});#Fly through them
The slab has a real base and top in metres (sky.cloudLayer). The camera can be under it, inside it or above it. The march adds near steps adaptively when you're inside.
towering deckpartlyCloudy deck#Static and dynamic rendering
const sky = await SkySystem.create({ renderer, scene, camera, cloudRenderingMode: 'static' });
sky.setCloudRenderingMode('dynamic');dynamic(default): clouds drift and evolve, lightning flashes, and the shadow and environment maps refresh on their quality-tier interval.static: evolution is frozen. The LUT, shadow and env maps only re-bake when a parameter or the time changes. Use it for product shots, architectural scenes, or anywhere GPU time is tight.
#Cloud shadows
The sky keeps a top-down transmittance map of the deck around the camera (±8 km by default, shadowExtent). Any built-in lit material can sample it:
sky.patchMaterial(terrain.material); // Standard, Physical, Lambert, Phong, ToonFor your own shaders, see Lighting your scene.