Reference
Weather parameters
WeatherPreset is the whole weather as one JSON-safe object of thirteen numbers. Presets are WeatherPresets, set() merges a subset into the targets, and getParams() prints the complete set.
weather.params; // the targets (what presets and set() write)
weather.state; // the eased values actually used, plus gust and daylight
weather.set({ fog: 0.3 }); // subset, eased
weather.set({ fog: 0.3 }, { instant: true });
weather.getParams(); // complete copy: targets + current wetness / snowCover, 3 decimals
weather.transitionRate = 0.4; // slower easing (1/s, default 0.9)#Precipitation and wind
| Key | Range | clear | Effect |
|---|---|---|---|
rain | 0–1 | 0 | Rain intensity: streak and splash count, fall speed, fog haze, wetting, audio |
snow | 0–1 | 0 | Snowfall intensity: flake count, fog haze and height, snow cover |
wind | 0–1 | 0.15 | Wind strength. 1 ≈ 13 m/s (47 km/h) before gusts |
windDirection | radians | 0.6 | Direction the wind blows toward. 0 = +x, π/2 = +z. Wanders ±0.25 on its own |
#Fog
| Key | Range | clear | Effect |
|---|---|---|---|
fog | 0–1 | 0.06 | Amount. Density ≈ 0.0015 + fog² × 0.11 per metre, plus rain and snow haze |
fogHeight | ≥ 0 | 1 | Height-falloff multiplier. 0.3 is ground fog |
fogLight | ≥ 0 | 1 | In-scattering multiplier |
#Lightning
| Key | Range | clear | Effect |
|---|---|---|---|
lightning | 0–1 | 0 | Automatic strike frequency: every ~22 s at the low end to ~2.5 s at 1. Off below 0.05 |
#Surfaces
| Key | Range | clear | Effect |
|---|---|---|---|
wetness | 0–1 | 0 | Surface wetness to ease to over ~4.5 s. After that it follows the weather |
snowCover | 0–1 | 0 | Snow cover to ease to over ~4.5 s. After that it follows the weather |
These two aren't eased like the rest. set({ wetness }) calls weather.wetness.force(...), and with { instant: true } it calls setImmediate. Read the live values from weather.wetness.wetness and weather.wetness.snowCover.
#Sky hints and exposure
| Key | Range | clear | Effect |
|---|---|---|---|
cloud | 0–1 | 0.15 | Suggested cloud cover for your sky. state.cloud is raised to at least rain × 0.9, snow × 0.8 and lightning |
time | 0–24 | 14 | Suggested time of day in hours, for your sky. Eases the short way round the clock |
exposure | > 0 | 1 | Multiplier for weather.render()'s exposure |
The library doesn't draw a sky, so cloud and time only matter if you read them. The demo sky reads weather.state.time and weather.state.cloud. cloud also slows drying in the sun.
#Derived state
weather.state holds the eased copy of every key above, plus:
| Key | |
|---|---|
gust | Gust factor, 0.5–1.2, multiplied into the wind speed |
daylight | 0 at night … 1 by day. From setLighting({ daylight }), or from the key light's height |
wetness, snowCover | Mirrors of weather.wetness.wetness and .snowCover |
The wind vector actually used, in m/s, is weather.uniforms.wind.value (x, 0, z).
#Easing
Every frame, each eased key moves toward its target by 1 − exp(−dt × transitionRate). With the default 0.9, a change is about 60 % done after a second and 93 % after three. time eases at its own fixed rate of 1.2. { instant: true } skips the easing.