NatureGL Weatherv1.1.0

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.

js
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

KeyRangeclearEffect
rain0–10Rain intensity: streak and splash count, fall speed, fog haze, wetting, audio
snow0–10Snowfall intensity: flake count, fog haze and height, snow cover
wind0–10.15Wind strength. 1 ≈ 13 m/s (47 km/h) before gusts
windDirectionradians0.6Direction the wind blows toward. 0 = +x, π/2 = +z. Wanders ±0.25 on its own

#Fog

KeyRangeclearEffect
fog0–10.06Amount. Density ≈ 0.0015 + fog² × 0.11 per metre, plus rain and snow haze
fogHeight≥ 01Height-falloff multiplier. 0.3 is ground fog
fogLight≥ 01In-scattering multiplier

#Lightning

KeyRangeclearEffect
lightning0–10Automatic strike frequency: every ~22 s at the low end to ~2.5 s at 1. Off below 0.05

#Surfaces

KeyRangeclearEffect
wetness0–10Surface wetness to ease to over ~4.5 s. After that it follows the weather
snowCover0–10Snow 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

KeyRangeclearEffect
cloud0–10.15Suggested cloud cover for your sky. state.cloud is raised to at least rain × 0.9, snow × 0.8 and lightning
time0–2414Suggested time of day in hours, for your sky. Eases the short way round the clock
exposure> 01Multiplier 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
gustGust factor, 0.5–1.2, multiplied into the wind speed
daylight0 at night … 1 by day. From setLighting({ daylight }), or from the key light's height
wetness, snowCoverMirrors 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.