threejs-weather
यह क्या करती है
यह स्किल 3D दृश्य में मौसम के प्रभाव जोड़ती है, ताकि वे कैमरे के दृश्य में दिखें और चिकनी तरह बदलें। यह वायुमंडलीय 3D दृश्य, गेम या प्रोडक्ट स्टेज बनाने वाले डेवलपर्स के लिए है।
कब इस्तेमाल करें
- ✓जब Three.js दृश्य में ऐसी बारिश या बर्फ़ चाहिए जो कैमरे की नज़र में रहे।
- ✓जब तूफ़ान बारिश से शुरू होकर बिजली और गरज के साथ बढ़े।
- ✓जब ज़मीन गीली दिखनी चाहिए, गड्ढों और छींटों के साथ।
Skill का लिंक
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/threejs-weather/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे Three.js दृश्य में बारिश और बिजली वाला तूफ़ान चाहिए, और ज़मीन गीली दिखनी चाहिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट कणों का एक छोटा आयतन बनाता है जो कैमरे के सामने चलता है, ताकि बूँदें हमेशा दिखें। तूफ़ान बारिश प्रणाली से बनते हैं, जिनमें अतिरिक्त झुकाव और बिजली अपनी रोशनी के साथ होती है, और बर्फ़ तब तक जमती है जब तक ज़मीन ढक न जाए।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Three.js Weather
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.
Anchor the volume in the frustum
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:
const 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.
Float32BufferAttribute copies your array
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:
const 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.
Density is a draw range, not a new buffer
Allocate the worst case once — a full storm, a full blizzard — and thin it by drawing less:
RAIN.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.
A storm is the rain leaned on
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".
Lightning is its own light
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:
const bolt = new THREE.DirectionalLight(0xe8eeff, 0);
One strike is several flashes — a leader and two or three return strokes — each an exponential decay:
function 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.
A blizzard is a slow envelope, not a state
Snow does not fall at one rate forever. Run a cycle — calm, build, blow, ease — and modulate the snow state with it:
const 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 arriv
अक्सर पूछे जाने वाले सवाल
मेरे बारिश के कण क्यों नहीं दिखते?
स्किल बताती है कि दुनिया के आकार का बॉक्स अक्सर कैमरे से बाहर रहता है, इसलिए आयतन को कैमरे के साथ चलना होगा।
क्या इसमें ध्वनि शामिल है?
हाँ। यह बिना जोड़ वाली लूप होती परिवेशी ऑडियो और दूरी से तय गरज कवर करती है।
क्या बर्फ़ बर्फ़ीले तूफ़ान में बदल सकती है?
हाँ। स्किल वह बर्फ़ कवर करती है जो हवा में उड़कर बर्फ़ीला तूफ़ान बनती है और ज़मीन पर जमती है।
जानकारी
लेखक का मूल विवरण
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 the viewer can turn.
repo: MengTo/Skills
लोकप्रियता
- GitHub स्टार
- 7.2k
- रैंकिंग में स्थान
- #13477
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
3d-cloth-material
7.2kआपके एजेंट को Three.js में असली बुने हुए कपड़े जैसा दिखने वाला मटीरियल बनाने में मदद करती है, जिसमें धागों की बुनाई, हल्की चमक, प्राकृतिक सिलवटें, किनारे और सीवन हों।
3d-falling-leaves
7.2kआपके एजेंट को 3D दृश्य में असली लगने वाली गिरती पत्तियाँ जोड़ने देती है, जो लुढ़कती हैं, हवा के साथ बहती हैं और कैमरा हिलने पर दोबारा इस्तेमाल होती हैं।
3d-four-seasons
7.2kआपके एजेंट को 3D दृश्य में वसंत, गर्मी, शरद और सर्दी के रूप जोड़ने देती है, जिसमें हरियाली, रोशनी, आसमान और बर्फ़ बिना दृश्य दोबारा बनाए बदलते हैं।
3d-high-poly-models
7.2kआपके एजेंट को चिकने आकार और विश्वसनीय किनारों वाले विस्तृत 3D मॉडल बनाने देती है, और फिर वेब पर अच्छे चलने वाले हल्के संस्करण तैयार करती है।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।