본문으로 건너뛰기
cccskills
무료GitHub에 공개

threejs

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(5)

  • SKILL.md3.4 KB
  • demo/index.html15.9 KB
  • demo/preview.jpg38.7 KB
  • demo/PROMPT.md1.9 KB
  • REFERENCES.md49 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Build convincing woven cloth in Three.js, with a thread-level weave normal map, sheen and anisotropic highlights, folds that never stretch the texture, hems with thickness, stitches, seams, frayed edges, fold occlusion, dye and wear variation, and light passing through thin fabric. Use for linen, silk, wool, canvas, curtains, banners, cloaks, tablecloths, tapestries or any 3D drape that currently looks like a plastic sheet, a stretched texture, or a flat coloured plane.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MengTo/Skills6.8천2026년 10월 18일 업데이트

Build recognizable falling leaves in world space using instanced geometry, independent tumble, coupled sideways drift, shared wind, scene occlusion, and camera-aware recycling. Use for 3D autumn leaves or drifting foliage in Three.js and similar scenes; use falling-leaves for a 2D canvas overlay.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MengTo/Skills6.8천2026년 10월 18일 업데이트

Add coordinated spring, summer, fall, and winter states to a 3D scene, blending foliage, sunlight, sky, ground materials, snow, and particles without rebuilding the world. Use for seasonal controls, architectural walkthroughs, and outdoor scenes with four-season transitions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MengTo/Skills6.8천2026년 10월 18일 업데이트

Create or integrate highly detailed 3D models with smooth silhouettes, shaped surfaces, believable bevels, and close-up geometry, then prepare suitable runtime LODs and loading. Use when a user requests high polygon counts, ultra-realistic models, detailed architectural assets, or removal of visibly faceted geometry.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MengTo/Skills6.8천2026년 10월 18일 업데이트

Build sharp, physically coherent high-resolution materials for 3D rendering with appropriate PBR maps, texel density, UV direction, mipmaps, anisotropic filtering, and progressive asset delivery. Use for detailed wood, stone, fabric, foliage, and architectural close-ups without excessive download or GPU memory costs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MengTo/Skills6.8천2026년 10월 18일 업데이트

Build hyperrealistic PBR metal in Three.js: steel, brass, gold, copper and iron as true conductors (metalness 1, measured F0 tint, no albedo) with roughness-varied finishes (polished, brushed anisotropic, aged with patina and worn edges) lit by a dark HDR studio of real bright window cards prefiltered with PMREM. Use when metal looks like grey plastic, a dull blur, or a black hole; when blades, tools, rings, ingots, hardware or product metal need reflections with edges and structure; or when a finish needs scratches, streaks, fingerprints and bevels that catch light.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MengTo/Skills6.8천2026년 10월 18일 업데이트

MengTo의 스킬 모두 보기

이 스킬의 문제 신고