मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)7.2k · #13478

threejs

यह क्या करती है

यह स्किल AI को ब्राउज़र में चलने वाले 3D दृश्य बनाने का मार्गदर्शन देती है, जैसे ऐसा प्रोडक्ट जिसे घुमाया जा सके या एनिमेटेड हीरो दृश्य। यह उन डिज़ाइनरों और डेवलपर्स के लिए है जिन्हें साधारण पृष्ठभूमि प्रभावों से आगे असली 3D चाहिए।

कब इस्तेमाल करें

  • ✓जब आप अपनी वेबसाइट पर ऐसा प्रोडक्ट चाहते हैं जिसे 3D में घुमाया या देखा जा सके।
  • ✓जब पेज पर 3D मॉडल लोड करके काम करती लाइट और कंट्रोल के साथ दिखाना है।
  • ✓जब 3D दृश्य पेज साइज़ बदलने पर धीमा हो या टूट जाए, और उसे ठीक करना है।

Skill का लिंक

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/threejs/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/threejs/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरी वेबसाइट पर एक 3D प्रोडक्ट व्यूअर बनाइए, जहाँ लोग माउस से बोतल को घुमा सकें।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह समझाती है कि 3D दृश्य को किन हिस्सों की ज़रूरत है, जैसे कैमरा, लाइट और रेंडरर, और मॉडल लोड करने व दृश्य को तेज़ रखने के पैटर्न देती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Three.js — WebGL 3D Scenes Skill

When to use

  • Real 3D: product spins, interactive hero scenes, shaders/material effects, 3D data viz
  • You need full control beyond “background effects”
  • You can budget time for asset pipeline + performance tuning

Core mental model

  • Create:
    • Scene (root graph)
    • Camera (Perspective/Orthographic)
    • Renderer (WebGLRenderer)
    • Mesh = Geometry + Material
    • Lights (if using non-unlit materials)
  • Render loop:
    • requestAnimationFrame(animate)
    • Update time-based animations, controls, mixers, then renderer.render(scene, camera)

Key APIs/patterns

  • Setup:
    • const renderer = new THREE.WebGLRenderer({ canvas, antialias, alpha })
    • renderer.setSize(width, height, false)
    • renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2))
  • Camera:
    • camera.aspect = width / height; camera.updateProjectionMatrix()
  • Scene graph:
    • scene.add(object) / object.position/rotation/scale
  • Loading assets:
    • GLTFLoader (models), TextureLoader (images), DRACOLoader (compressed glTF)
  • Controls (common):
    • OrbitControls (debug/product), PointerLockControls (FPS), custom pointer handlers
  • Cleanup (important in SPAs):
    • geometry.dispose(), material.dispose(), texture.dispose(), renderer.dispose()
    • Remove event listeners; cancel RAF.

Common pitfalls

  • Not handling resize → stretched/cropped rendering
  • Too high devicePixelRatio → mobile GPU meltdown
  • Leaking WebGL resources (not disposing) → crashes after route changes
  • Loading huge textures/models → slow start; use compressed textures, Draco/KTX2, smaller maps
  • Using too many lights/shadows → expensive; fake lighting with baked textures when possible

Quick recipes

1) Minimal spinning cube

import * as THREE from "three";

const canvas = document.querySelector("#c");
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 0, 4);

const geom = new THREE.BoxGeometry(1, 1, 1);
const mat = new THREE.MeshStandardMaterial({ color: 0x7c3aed });
const mesh = new THREE.Mesh(geom, mat);
scene.add(mesh);

scene.add(new THREE.AmbientLight(0xffffff, 0.8));
const dir = new THREE.DirectionalLight(0xffffff, 0.8);
dir.position.set(2, 2, 2);
scene.add(dir);

function resize() {
  const w = canvas.clientWidth;
  const h = canvas.clientHeight;
  renderer.setSize(w, h, false);
  renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
  camera.aspect = w / h;
  camera.updateProjectionMatrix();
}
window.addEventListener("resize", resize);
resize();

function animate(t) {
  mesh.rotation.y = t * 0.0006;
  renderer.render(scene, camera);
  requestAnimationFrame(animate);
}
requestAnimationFrame(animate);

2) Respect reduced motion

  • If prefers-reduced-motion: reduce, render a still frame (no RAF) or slow updates.

What to ask the user

  • Is this decorative (hero) or functional 3D (product viewer)?
  • Target devices: mobile? older iPhones?
  • Asset format availability (glTF, HDRI, textures) and file size constraints
  • Accessibility/reduced motion requirements
अक्सर पूछे जाने वाले सवाल

क्या इसे इस्तेमाल करने के लिए 3D प्रोग्रामिंग जानना ज़रूरी है?

नहीं। स्किल AI को दृश्य सेट करना बताती है, लेकिन पेज पर क्या दिखना है, यह आपको बताना होगा।

क्या यह 3D मॉडल फ़ाइलें लोड कर सकती है?

हाँ। स्किल glTF मॉडल लोड करना कवर करती है, जो वेब पर 3D चीज़ों का आम फ़ॉर्मेट है।

क्या यह सिर्फ़ बड़े 3D प्रोजेक्ट के लिए है?

नहीं। यह लैंडिंग पेज पर एक छोटे इंटरैक्टिव 3D पल के लिए भी मदद कर सकती है।

जानकारी

लेखक का मूल विवरण

Use when building or debugging interactive 3D scenes on the web with Three.js (scene/camera/renderer, lights/materials, GLTF loading, controls, performance). Helpful for designers shipping 3D UI moments.

repo: MengTo/Skills

लोकप्रियता

GitHub स्टार
7.2k
रैंकिंग में स्थान
#13478
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

3d-cloth-material

7.2k

आपके एजेंट को Three.js में असली बुने हुए कपड़े जैसा दिखने वाला मटीरियल बनाने में मदद करती है, जिसमें धागों की बुनाई, हल्की चमक, प्राकृतिक सिलवटें, किनारे और सीवन हों।

कोडिंगवेबसाइट और UI (frontend)

3d-falling-leaves

7.2k

आपके एजेंट को 3D दृश्य में असली लगने वाली गिरती पत्तियाँ जोड़ने देती है, जो लुढ़कती हैं, हवा के साथ बहती हैं और कैमरा हिलने पर दोबारा इस्तेमाल होती हैं।

कोडिंगवेबसाइट और UI (frontend)

3d-four-seasons

7.2k

आपके एजेंट को 3D दृश्य में वसंत, गर्मी, शरद और सर्दी के रूप जोड़ने देती है, जिसमें हरियाली, रोशनी, आसमान और बर्फ़ बिना दृश्य दोबारा बनाए बदलते हैं।

कोडिंगवेबसाइट और UI (frontend)

3d-high-poly-models

7.2k

आपके एजेंट को चिकने आकार और विश्वसनीय किनारों वाले विस्तृत 3D मॉडल बनाने देती है, और फिर वेब पर अच्छे चलने वाले हल्के संस्करण तैयार करती है।

कोडिंगवेबसाइट और UI (frontend)

मिलती-जुलती skills