Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Put weather into a Three.js scene that reads as weather — rain anchored inside the frustum, a storm that is the rain leaned on rather than a second system, lightning on its own light with thunder scheduled by distance, snow that blows up into blizzards and keeps settling until the ground goes white, wet ground with puddles and splashes, and looping ambience that has no seam. Use for scene atmosphere, seasonal states, hero backdrops, or any world where clear/rain/storm/snow needs to be a control
.claude/skills/mengto-threejs-weather/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 16% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 129% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 38% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 39% | 0% |
Weather fails in two ways: the particles miss the camera entirely, or every state is a separate system that shares nothing. Both are avoidable.
Pairs with threejs-landscape for the ground it falls on, and threejs-towers for something to fall against.
The first version of any rain system puts a world-sized box of particles around the origin and looks empty. With a long lens the camera sees a narrow cone, so almost every drop is off-camera.
Build a small volume and carry it in front of the camera, facing the way the camera faces:
jsconst WX_W = 17, WX_D = 50, WX_TOP = 40; // narrow, deep, tall function anchor(o) { const fx = -Math.sin(camAz), fz = -Math.cos(camAz); o.position.set(cam.position.x + fx * 46, 0, cam.position.z + fz * 46); o.rotation.y = camAz; }
Set frustumCulled = false on it — you are moving it every frame and the bounding sphere will fight you.
This one costs an afternoon. The attribute takes a copy of whatever you hand it, so the array you kept a reference to is not the one the GPU reads:
jsconst attr = new THREE.Float32BufferAttribute(pos, 3); attr.setUsage(THREE.DynamicDrawUsage); geo.setAttribute('position', attr); return { pts, pos: attr.array, n }; // keep the attribute's array
Symptom: everything is correct, nothing moves, no error anywhere.
Allocate the worst case once — a full storm, a full blizzard — and thin it by drawing less:
jsRAIN.geo.setDrawRange(0, Math.round(RAIN.n * density));
A storm then costs no more memory than drizzle; it just stops hiding most of the drops. Reallocating buffers when weather changes causes a hitch exactly when the viewer is watching.
Do not write a second particle system. Take the rain state and push every dial:
| | rain | storm | |---|---|---| | drops drawn | 60% of pool | 100% | | fall speed | ×1.0 | ×1.42 | | slant | 2.4 | scales with speed² | | sun | 30% | 14% | | fog far | ×0.52 | ×0.38 |
Slant should grow faster than speed — slant = base * v * v — because that is what sells wind rather than "rain, but quicker".
Do not modify the time-of-day state to flash. Add a light nobody else touches, so a strike can flash over whatever the sky happens to be doing:
jsconst bolt = new THREE.DirectionalLight(0xe8eeff, 0);
One strike is several flashes — a leader and two or three return strokes — each an exponential decay:
jsfunction strike() { const near = Math.random(); // 0 distant … 1 close const s = 0.42 + near * 0.58; pulses = [{ t: 0, a: s }]; let tt = 0; for (let i = 0, n = 1 + (Math.random() * 2.6 | 0); i < n; i++) { tt += 0.05 + Math.random() * 0.14; pulses.push({ t: tt, a: s * (0.30 + Math.random() * 0.65) }); } setTimeout(() => sfx(near > 0.5 ? 'thunder_near' : 'thunder_far', { gain: 0.30 + near * 0.60 }), (0.32 + (1 - near) * 2.7) * 1000); // sound arrives late } function step(dt) { let v = 0; for (const p of pulses) if (age >= p.t) v += p.a * Math.exp(-(age - p.t) / 0.085); bolt.intensity = v * 3.2; skyMat.color.setScalar(1 + v * 0.80); // multiplies the sky map flashEl.style.opacity = (v * 0.15).toFixed(3); }
Two details do most of the work. Thunder is delayed by distance and quieter the longer it takes — that single correlation is what makes a strike feel far away. And the DOM flash belongs under the type, not over it: a full-screen white overlay above your typography washes the page out, so put it directly above the canvas and keep it under about 0.18 opacity.
Reposition the light on every strike. A flash that always comes from the same side stops reading after the second one.
Snow does not fall at one rate forever. Run a cycle — calm, build, blow, ease — and modulate the snow state with it:
jsconst BLIZ = [12, 6, 15, 8]; // seconds function blizzardAt(t) { let u = t % TOTAL; if (u < 0) u += TOTAL; if (u < BLIZ[0]) return 0; ... // smoothstep in, hold, out }
During the blow, open the flake pool, thicken the flakes, drive them sideways and pull the fog in. Reset the phase clock to zero when you leave the snow state, or arriving in snow drops you into the middle of a whiteout — a negative start offset wraps into the wrong phase and looks like a bug you cannot find.
The one people forget. Track what has already landed on its own slow timer, rising while snow falls and melting back when the weather turns:
jssnowPack += (target - snowPack) * (target > snowPack ? dt / 24 : dt / 13);
Then let it keep whitening the ground, the stones and the grass for as long as it falls. Arriving in snow and standing in it for a minute should not look the same.
If the surface colour is mixed inside a shader — instanced grass usually is — the material colour cannot reach it. Give that mix its own uniform, and let snow lie on the tips first and work down:
glslgBase = mix(gBase, vec3(0.60, 0.65, 0.72), uSnow * 0.86); gTip = mix(gTip, vec3(0.90, 0.94, 1.00), uSnow);
Relighting the scene is not free, and blizzard strength and snow depth drift continuously. Gate it:
jsconst look = blizK + snowPack; if (Math.abs(look - lastLook) > 0.006) { lastLook = look; refreshLook(); }
That fires a few times a second instead of sixty, and nothing on screen can tell.
Three cheap things, in order of payoff: drop roughness and add a little metalness so the ground catches the sky; add flat translucent puddle decals in the hollows; then instance a splash ring sprite with a short life, spawned in proportion to rain intensity. The splashes are what make it read as falling rain rather than a rain texture.
Generated audio never loops cleanly. Fold the tail back over the head with an equal-power cross-fade and throw the overlap away — the clip then ends where it starts:
pythonfor i in range(f): t = i / f out[i] = a[i] * sin(t * pi / 2) + a[n - f + i] * cos(t * pi / 2)
Fading the clip in and out instead means it dips to silence every lap, which everyone hears and nobody mentions.
Give weather its own gain bus, separate from music, and run the blizzard as a second layer swelling over the base bed rather than a cross-fade to a different clip — a hard swap in the middle of a storm is obvious.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | pass→pass | 20,972 | 15,749 | -25% | 1 | 1 | 0% | 2,309 | 3,924 | +70% | 0 | 0 | — |
case-01 | fail→pass | 49,942 | 41,834 | -16% | 1 | 1 | 0% | 8,277 | 9,497 | +15% | 0 | 0 | — |
case-02 | fail→pass | 39,377 | 34,040 | -14% | 1 | 1 | 0% | 6,744 | 7,850 | +16% | 0 | 0 | — |
case-03 | fail→fail | 38,679 | 36,524 | -6% | 1 | 1 | 0% | 5,789 | 8,114 | +40% | 0 | 0 | — |
case-04 | pass→pass | 16,306 | 14,299 | -12% | 1 | 1 | 0% | 1,986 | 3,649 | +84% | 0 | 0 | — |
case-06 | fail→pass | 17,291 | 16,917 | -2% | 1 | 1 | 0% | 1,782 | 4,089 | +129% | 0 | 0 | — |
case-07 | pass→pass | 19,988 | 14,489 | -28% | 1 | 1 | 0% | 2,171 | 3,666 | +69% | 0 | 0 | — |
case-08 | fail→pass | 19,073 | 11,686 | -39% | 1 | 1 | 0% | 2,354 | 3,252 | +38% | 0 | 0 | — |
case-09 | pass→pass | 21,212 | 14,037 | -34% | 1 | 1 | 0% | 2,207 | 3,553 | +61% | 0 | 0 | — |
case-10 | pass→pass | 21,238 | 21,093 | -1% | 1 | 1 | 0% | 2,566 | 4,418 | +72% | 0 | 0 | — |
case-11 | pass→pass | 21,190 | 14,925 | -30% | 1 | 1 | 0% | 2,521 | 3,758 | +49% | 0 | 0 | — |
case-12 | pass→pass | 20,763 | 20,184 | -3% | 1 | 1 | 0% | 2,384 | 4,387 | +84% | 0 | 0 | — |
case-13 | fail→pass | 24,575 | 18,395 | -25% | 1 | 1 | 0% | 3,057 | 4,245 | +39% | 0 | 0 | — |
case-14 | pass→pass | 21,720 | 15,135 | -30% | 1 | 1 | 0% | 3,045 | 4,012 | +32% | 0 | 0 | — |
case-15 | fail→pass | 17,826 | 10,893 | -39% | 1 | 1 | 0% | 1,830 | 2,907 | +59% | 0 | 0 | — |
case-16 | pass→pass | 15,125 | 11,721 | -23% | 1 | 1 | 0% | 1,646 | 3,237 | +97% | 0 | 0 | — |
case-17 | pass→pass | 19,787 | 10,933 | -45% | 1 | 1 | 0% | 2,353 | 3,152 | +34% | 0 | 0 | — |
case-18 | pass→pass | 18,868 | 12,825 | -32% | 1 | 1 | 0% | 2,081 | 3,248 | +56% | 0 | 0 | — |
case-19 | pass→pass | 21,720 | 18,184 | -16% | 1 | 1 | 0% | 2,612 | 4,212 | +61% | 0 | 0 | — |
case-20 | pass→fail | 29,789 | 28,753 | -3% | 1 | 1 | 0% | 4,390 | 6,492 | +48% | 0 | 0 | — |
case-21 | pass→pass | 17,765 | 20,360 | +15% | 1 | 1 | 0% | 2,315 | 4,985 | +115% | 0 | 0 | — |
case-22 | pass→pass | 15,792 | 17,996 | +14% | 1 | 1 | 0% | 1,787 | 4,384 | +145% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.