NatureGL Weatherv1.1.0

Guides

Snow

Snow has two halves. Flakes fall in a box around the camera, and snow cover builds up on your patched materials over time. The two run on separate dials, so a settled blanket can sit under a clear sky.

Snow starting on a dry square. set({ snow: 0.9, … }) starts the flakes, and cover builds on the roofs, benches and cobbles. Accumulation is sped up 4× here with weather.wetness.rate = 4.

#Falling snow

js
weather.set({ snow: 0.55 });          // calm snowfall
weather.set({ snow: 1, wind: 1 });    // driving snow
weather.loadPreset('blizzard');

snow (0–1) scales the flakes drawn, up to the tier's count: 9k on low to 42k on ultra. The flakes are swaying billboards in a 34 × 22 × 34 m box around the camera. In strong wind they stretch along their apparent motion, and now and then a tumbling flake glints. Like rain, they're culled under occluders.

Snow also thickens the fog (density + snow × 0.012, and a taller fog layer) and raises state.cloud to at least snow × 0.8.

js
weather.snow.flakeSize = 0.03;   // flake radius in metres (default 0.022)
snowfall: calm snow over a settled blanket
blizzard: gale-force wind and white-out fog

#Snow cover

Snow cover lives in weather.wetness (the SurfaceWeather) next to wetness. It is 0–1 and changes every frame:

EffectRate per second at full strength
Snowfall covers+0.03 × snow
Rain melts−0.05 × rain × cover
Daylight melts, only while it isn't snowing−0.003 × daylight

Multiply the rates with weather.wetness.rate (default 1). To set cover directly:

js
weather.set({ snowCover: 0.8 });               // ease there over ~4.5 s, then accumulate naturally
weather.set({ snowCover: 1 }, { instant: true });
weather.wetness.force(null, 0.5, 2);           // ease to 0.5 over 2 s, wetness untouched

Presets carry a snowCover too: snowfall eases to 0.8 and blizzard to 1.

#Where it settles

Every patched material collects snow on up-facing faces:

  • Coverage uses the true face normal, so pitched roofs are covered even when the mesh has smooth vertex normals. The edge is broken up with noise.
  • { ground: true } materials get the full blanket.
  • Anything under an occluder stays clear, like the ground under the well roof or a bench.
  • Covered surfaces are shaded with the face normal, glint in the sun (shadow-aware), and turn cool blue in shade.
  • Snow cover also counts as slight wetness (max(wetness, cover × 0.15)) and hides puddles.
NatureGL Weather
weatherpro.html
weatherpro.htmlNatureGL Weather
snowfall in the original page and in the package. The package covers the roof slopes, keeps the ground under the well roof and the benches dry, and adds glints.

#Rain on snow

Rain on a snow blanket melts it at 0.05 × rain × cover per second, and splashes fade out as cover builds; above 90 % cover they're hidden. Going from snowfall to downpour gives you a thaw, not an instant switch.

#Using SnowSystem on its own

js
import { SnowSystem } from 'naturegl-weather';

const snow = new SnowSystem({ scene });   // maxFlakes 42000
snow.intensity = 0.6;
// per frame: snow.update(dt, camera);

Standalone flakes have no occlusion map and no wind, and there is no snow cover. Cover needs SurfaceWeather and the patched materials, which the facade wires up for you.