snow-weather
Installation
SKILL.md
Snow and weather
Target: Three.js 0.187.0, three/webgpu and TSL node materials from three/tsl; WebGPU only, no WebGL fallback, no GLSL strings.
Two companion files in this folder. Copy them into the project:
scripts/blizzard.tsl.js:SnowField, a GPU compute snowfall, andsoftAlphaAt, a soft-particle helper. Imports onlythree/webgpuandthree/tsl.scripts/weather-spells.js:WeatherSpells, the CPU scheduler. Plain JS, no imports.
What it is
- SnowField. Up to 64k flakes in a square box (160 x 160 x 18 m by default) around the camera's ground point. One compute pass and one instanced sprite draw. Flakes wrap toroidally in x/z, so the field follows the camera with no spawn band. Each flake chases a target velocity: wind x height shear x two gust fronts, plus fall, plus two octaves of trig turbulence, plus a per-flake swing. It fades in the last 0.15 m before the ground, never shows inside an optional camera bubble or inside exclusion boxes (vehicles), and is lit by the scene light with a floor. Opacity and density are driven separately. A built-in squall clock adds whiteouts. An ash variant turns the same flakes dark.
- WeatherSpells. Spells of calm, steady or storm character, picked by weight. Each eases a
snowingscalar through a cloud gate. A caller-suppliedwintervalue decides rain or snow, never both. Also: a wetness integrator, high-keybrightspells, ground gusts, a powder opacity, and a generic scripted event (wind and ash ramps).
When to use it
- A camera moving through open country in snow or rain: driving, flying low, walking.
- Weather that changes over minutes and is read by other systems: sky, fog, lighting, wet roads, audio.
- Do not use it for a fixed diorama with a static camera. A few hundred CPU sprites are enough there.