Guides
Volumetric fog
Height fog that is densest at the ground and thins with altitude. Through weather.render() it's raymarched, with shadowed light shafts, lamp halos and lightning glow. On the plain path it becomes a matching THREE.FogExp2.
foggyDawn with fog eased from 0.05 to 0.62. transitionRate is lowered to 0.35 for this clip so the bank rolls in slowly. The shafts are the house and tree shadows from the shadowLight.#The dials
weather.set({ fog: 0.4 }); // amount
weather.set({ fog: 0.62, fogHeight: 0.3 }); // low ground fog, like foggyDawn
weather.set({ fogLight: 0.5 }); // dimmer in-scattering| Param | Range | Effect |
|---|---|---|
fog | 0–1 | Amount |
fogHeight | ≥ 0 | Height-falloff multiplier. 1 is normal, 0.3 hugs the ground |
fogLight | ≥ 0 | In-scattering multiplier: how brightly the fog glows in the light |
Each frame FogSystem turns these (plus rain and snow) into physical values:
density = 0.0015 + fog² × 0.11 + rain × 0.01 + snow × 0.012 (1/m, at the fog base)
height = (5 + fog × 12 + snow × 8) × fogHeight (m, exponential falloff)weather.fog.visibility reports 3 / density in metres, the distance at which 95 % of the light is gone at the fog base. The demo HUD shows it as VIS.
#With weather.render()
The pipeline raymarches the fog at reduced resolution. Steps and resolution come from the quality tier: 20 steps at 0.35× on low, up to 56 steps at 0.75× on ultra. Along the way it adds:
- Light shafts. With a shadow-casting
shadowLight(see below), the march samples its shadow map, so sunlight and moonlight break into shafts around your geometry. - Lamp halos. The
localLightsglow in the fog. - Lightning. The flash lights the fog volume around the bolt.
- Drift. The fog noise drifts with the wind.
weather.setLighting({ shadowLight: sun }); // a DirectionalLight with castShadow = true
weather.fog.rays = false; // shafts off (the demo's "Fog rays" toggle)
weather.fog.maxDistance = 120; // march distance, default 170 m

foggyDawn with the shafts off and on. The low sun behind the houses throws shadow shafts through the ground fog.#With renderer.render()
When you don't call weather.render(), the fog is written to scene.fog as a THREE.FogExp2. Its density is matched to the same 95 % visibility, and its colour is the fog ambient × fogLight. Every built-in material fogs with it.
weather.fog.sceneFog = 'auto'; // default: FogExp2 only while render() isn't used
weather.fog.sceneFog = true; // always drive scene.fog
weather.fog.sceneFog = false; // never touch scene.fog (e.g. next to NatureGL Water)Once you call weather.render() for the first time, 'auto' removes the FogExp2 it created, and the volumetric fog takes over.
#Fog colour
The fog is lit by your light, not given a colour. setLighting feeds it:
skyHorizonandskyZenithset the fog ambient (horizon × 0.4 + zenith × 0.15, plus a little of the key light). They only take effect as a pair: one without the other is ignored.- Otherwise
ambientis used (ambient+ a little of the key light). - The key light (
sunDirection,sunColor,sunIntensity) makes it glow toward the sun.
Next to NatureGL Sky, the ambient you pass from the sky drives the fog colour. See With other packs.
foggyDawn: fog 0.62 with fogHeight 0.3, so the fog stays under the rooftops and the low sun lights it from behind.