/ghibli-threejs:threejs-webgl-rain-effectfrom ghibli-threejs
Adds clear, rain, or thunderstorm weather to a three.js scene using a single eased wetness value. Includes GPU rain streaks, rain rings, lightning with Poisson strikes, multi-pulse flashes, Web Audio thunder, wind gusts, wet materials, and storm sky/cloud/fog changes. Works with vanilla three.js or R3F.
Ships in ghibli-threejs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
One number, WEATHER.rain (clear 0, rain 0.7, storm 1), eases toward the selected mode and the
whole scene reads it: rain streaks and water rings scale with it, the sky and clouds go slate by
day and ink by night, the sun dims, fog thickens, materials get wet, and above ~0.75 lightning
starts.
Stack: three.js WebGLRenderer (vanilla or R3F) with ShaderMaterial / onBeforeCompile
patches; assumes a sun-update function (applySun) that writes lights and sky, and optionally a
night blend (threejs-ghibli-night-mode).
Add weather to
{{scene}}. One eased wetness value (clear 0, rain 0.7, storm 1) drives:
- GPU rain streaks in a camera-following box, slanted by the wind, faded at the lens and the box edge
- rain rings on the water
- lightning: Poisson strikes, multi-pulse flashes, a cold directional burst, the fill light and fog lifted, delayed brown-noise thunder
- denser, colder fog; a slate/ink sky; darker clouds; dimmer sun, moon, stars and god rays; wind gusts
- wet materials: roughness down, colour darker
Alternate a clear day and a storm night across page loads (
?weather=overrides). Expose everything in lil-gui with.listen(), plus a HUD button that cycles the modes. Verify that clear → storm → clear returns to the exact starting light values.
applySun writes the clean state; the weather
captures it as a base; each frame writes base × factors.applySun runs, restore the base (weatherUndo), because a night blend that skips
half its writes in pure day would otherwise capture storm-tinted values as the new base.applySun: weatherUndo() → applyDay() → applyNight(k) → captureBase() → applyWeather().applySun runs long before the weather module exists. Guard it with a hoisted
var weatherReady = false (set true at the end of the weather module), not a const, which
would hit the temporal dead zone.darkness d = min(1, rain·1.25)·0.75; sun × (1 − 0.85·d), hemi × (1 − .25d),
ambient × (1 − .2d), exposure × (1 − .18d). At 29 % less sun a rainy day still looked sunny.0x6f7880 / 0x8a939a / 0xa3aaae (day) and 0x10151f / 0x1a2230 / 0x2a3240
(night); clouds toward 0x7a8290 / 0x565d69 / 0x2c313b. Moon × (1 − .8r), god rays × (1 − r),
stars × (1 − .92r).+= rain·0.016; colour toward 0x8c969d by day /
0x232a36 by night × d·.85.references/weather-state.js.instanceCount = RAIN_MAX·density·smoothstep(rain, .02, .4).p = cam + (fract(seed − t·speed/box) − .5)·box, x/z
drifted by the wind. Speed ~9.5 m/s ± 20 %.normalize(wind.x, −speed, wind.z); width axis =
cross(fall, view). Length 0.32–0.54 m, width 1.2–2 cm.(1 − vT)·vT·4 tapers each streak. Colour = sky hemisphere colour lerped to
pale grey, ×0.55 at night; flashes brighten it (1 + flash·2.5).references/rain-streaks.js.In the water normal: a jittered cell grid (two offset layers, ~2.6 cells/m). Each cell's ring
radius is fract(t·rate + hash)·.42, profile sin((L − R)·44)·exp(−((L − R)·13)²)·(1 − age),
and step(hash, rain·.9 + .1) thins the rings at light rain. Fade by 1/(1 + dist·.06).
The same uRain uniform drives rock/terrain wetness (see threejs-stylized-rock-material).
t − ln(1 − U)·60/(rate·(r − .7)/.3),
rate ≈ 5 strikes/min at full storm. Seed the first one from the live clock (t + 3..9 s).[offset, amp], flash k = max(amp·exp(−14·(age − offset))).DirectionalLight(0xdfe6ff) placed high at a random azimuth, intensity
k·7; hemi +k·1.6, ambient +k·.5; sky, clouds and fog lerp toward pale blue-white.(1 − i/len)^1.6 tail, low-pass 160–280 Hz, delayed
1.2–3.4 s, gain ∝ rain. Only after the visitor's gesture has started audio.uWind = base·(1 + r·1.4·(.75 + .25 sin(.37t) + .15 sin(1.3t))) — trees, grass, swings follow.(1 − .5w), colour × (1 − .2w), with w = rain·wet·2. Take the list only
after the models load, record originals once, rescale only when w moves > 0.01, and skip
materials another system recolours (the night's white-dim list).Alternate clear day / storm night across page loads (store the last mode in localStorage, in a
try block), ?weather=clear|rain|storm overrides. A HUD button cycles clear → rain → storm.
lil-gui controllers use .listen() so they follow the eased values; a "⚡ strike now" button helps testing.
const weatherReady referenced by an early applySun throws; use hoisted var.next: 8) fire at once because the frame clock
is page time; seed from the first step's t.threejs-day-cycle-lighting · threejs-ghibli-night-mode · threejs-webgl-realistic-water ·
threejs-stylized-rock-material · threejs-ghibli-sky-clouds · threejs-webaudio-generative-soundtrack ·
threejs-webgl-performance-profiling
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub nicksonthc/ghibli-threejs --plugin ghibli-threejs31 skills in this plugin
/threejs-blender-glb-pipelineBuilds a reference-image-driven asset pipeline from headless Blender to GLB for a three.js scene — an asset contract (units, axes, grounding, required mesh/material names, budgets, attachment numbers), one parallel subagent per asset group writing craft_<slug>.py generators, preview renders compared against the reference, measured-bounding-box placement in the web scene, Draco compression, and a scored asset quality pass. Use when the user has a reference picture and wants a 3D scene from it, asks to model props/trees/characters in Blender for three.js, export GLBs, fix glTF export issues (vertex-colour alpha, UV flip, axes, custom normals), compress models, or rate and improve every asset in a scene./threejs-boat-buoyancy-steeringFloats a boat (or any buoyant prop) on three.js water with Gerstner waves generated from one JS table that feeds both the GLSL vertex shader and a CPU waveHeight(), four-probe heave/pitch/roll damped springs, an arc-length drift lane that bends round rocks, click-to-steer W/A/S/D rowing with momentum and drag, an autopilot that pursues the lane back, and a chase camera that keeps the orbit. Use when the user wants a drifting or steerable boat, buoyancy, objects bobbing on waves, Gerstner waves on a river/lake, a boat autopilot, or a follow/chase camera behind a vehicle on water./threejs-camera-guided-tourBuilds a hands-free guided camera tour for a three.js scene — keyframes as data, a time-parametrised Catmull-Rom (Hermite) path with continuous velocity, one camera-owner flag, the tour driving time of day and a day→night blend, staged creatures crossing the frame, handwritten captions, portrait-phone lens widening, instant hand-back on drag/scroll/tap/Esc, and a seek() hook for screenshots and video capture. Use when adding a tour mode, cinematic flythrough, attract mode, camera path animation, keyframed camera, spline camera or showcase video capture to a WebGL scene./threejs-cinematic-loading-screenBuilds a cinematic loading gate for a three.js scene — a painted CSS dawn (layered gradients, drifting blurred mist bands, optional conic god rays, SVG feTurbulence grain, vignette), a 2D-canvas layer of falling petals and glowing motes, a handwritten title that animates in, a gold progress line with stage captions, then "tap anywhere to enter" whose tap is the browser gesture that unlocks audio; uses a still captured from the live scene as the backdrop that cross-fades into the real render, and warms up shaders before lifting so the first interaction never stalls. Use when adding a loading screen, splash screen, intro curtain, preloader, tap-to-start / audio unlock gate or shader pre-compilation to a WebGL scene./threejs-day-cycle-lightingAnimates the sun in a three.js scene from sunrise to sunset through a single applySun(az, el) writer — azimuth sweep, elevation arc, warm-to-gold light colour, horizon falloff, warming sky dome and fog, re-aimed god rays and every sun-driven shader uniform — plus a cinematic "sun follows the lens" mode that keeps the sun beside the camera heading for backlit shots with boosted god rays and forward scattering. Use when adding a day/night cycle, time-of-day slider, sunrise/sunset, moving sun, backlit tour shots, or when several systems fight over the sun direction in WebGL/R3F./threejs-dreamy-glass-hudTurns a three.js scene's DOM overlay into one coherent, dreamlike HUD — a single frosted-glass material shared by every pill, badge and popover whose colours are registered CSS properties so the whole HUD cross-fades from pearl to deep indigo as the scene turns to night; an inline-SVG icon dock whose lit toggles glow gold instead of shouting; a glass popover in place of a native select; first-visit hints "whispered" in handwriting that step aside the moment the visitor understands; a HUD that drifts away after half a minute of stillness; a mote of light under each tap; a staggered arrival after the loading gate; and letterbox bars during a camera tour. Use when the overlay UI looks like a dev panel on top of a beautiful scene, when asked for a dreamy, cinematic, premium or 梦幻 / 绝美 UI, glassmorphism, a day/night-aware HUD, onboarding hints, auto-hiding UI, tap feedback, or to restyle lil-gui to match.