Use this skill when work touches Three.js: scene/camera/renderer setup, render loop, geometry, materials, textures, lights/shadows, glTF assets, animation, picking, controls, post-processing, WebGPU/TSL, XR, performance/memory, TypeScript/bundling, or version upgrades.
Snapshot: three@0.186.1 = r186 (2026-09-24), @types/three@0.186.0. Next dev line is r187 (migration notes exist, not released). Refresh from source-map.md if versions differ.
Workflow
- Inspect the project:
threeversion (npm0.x.y= releaser<x>),@types/threematch, renderer in use (WebGLRenderervsthree/webgpu), bundler/import map, loop style (setAnimationLoopvs custom rAF), React wrapper (R3F) or vanilla. - Everyday setup, loop, resize, geometry, picking, controls: usage-guide.md.
- Materials, textures, color space, lights, shadows, environment maps: materials-textures-lighting.md.
- glTF/Draco/Meshopt/KTX2 loading and the animation system: loaders-animation.md.
WebGPURenderer, node materials, TSL, compute,RenderPipeline: webgpu-tsl.md.- Draw calls, instancing, memory/dispose,
EffectComposer, profiling: postprocessing-performance.md. - Addon locations (
three/addons/*groups, package entry points): addons-index.md. - React (R3F v9, drei, Canvas, hooks, WebGPU
glfactory): react-three-fiber.md. Companion packages (postprocessing, three-mesh-bvh, gltf-transform, Rapier, troika, pathtracer) with versions and compatibility: ecosystem-packages.md. - Upgrades and deprecations (r170 to r186): migration.md. Official URLs to refresh: source-map.md.
- Verify:
bunx tsc --noEmit, a production build, console clean ofTHREE.warnings,renderer.infostable across a mount/unmount cycle.
Decision Rules
- Default to
WebGLRenderer(import fromthree) for broad compatibility and existingShaderMaterial/onBeforeCompile/EffectComposercode. - Choose
WebGPURenderer(import fromthree/webgpu) for TSL, compute shaders, node materials, clustered lights, or the new post stack. It uses WebGPU and falls back to a WebGL 2 backend (forceWebGL: trueto test). The manual still calls it experimental. ShaderMaterial,RawShaderMaterial,onBeforeCompile, andEffectComposerdo not work withWebGPURenderer; port to node materials/TSL andRenderPipeline.- With
three/webgpu, import everything (core and renderer) fromthree/webgpuand TSL fromthree/tsl. Do not mixthreeandthree/webgpuclass identities; aliasthreeto the webgpu build as the manual's import map does. - Addons come from
three/addons/...(maps toexamples/jsm). Pin addons and core to the same version. - Prefer
renderer.setAnimationLoop(fn)over hand-rolled rAF: it handles WebGPU init and XR. - React app: use R3F v9 + drei (React 19); keep per-frame work in
useFramerefs. No React: plain three. - Package choice: addons first (
three/addons), then pmndrs/ecosystem packages per the decision table in ecosystem-packages.md.postprocessing(pmndrs) capsthree <0.187and is WebGL only. - Use
THREE.Timerfor delta time;Clockis deprecated (r183).
Pitfalls
- Color textures need
texture.colorSpace = THREE.SRGBColorSpace; data maps (normal, roughness, AO, metalness) stayNoColorSpace. Wrong settings cause washed-out or dark scenes. - Lights use physical units; old intensity values look wrong. PBR materials need
scene.environmentor lights. - Cap pixel ratio (
Math.min(devicePixelRatio, 2)), updatecamera.aspectand callupdateProjectionMatrix()on resize. - After editing
InstancedMeshmatrices setinstanceMatrix.needsUpdate = true; recompute bounding volumes for culling/picking. - Disposing:
geometry,material,texture,RenderTarget, andrendererneeddispose(); removing from the scene frees nothing on the GPU.WebGPURenderer.dispose()is async since r186. - Never create geometries, materials, vectors, or raycasters inside the render loop; reuse scratch objects.
PCFSoftShadowMapis deprecated (r182) and removed for WebGPU (r186); usePCFShadowMap.RGBELoaderisHDRLoader(r180);PostProcessingisRenderPipeline(r183);renderAsync/computeAsyncare deprecated (r181): useawait renderer.init()then sync calls.- The CommonJS build is deprecated (r186) and minified builds were removed; use ESM.
@types/threeminor must trackthreeminor (0.186.x with 0.186.x).
Verification
Report which checks ran: typecheck, production build, browser run on the target renderer (WebGPU and the WebGL fallback if both matter), renderer.info (calls, triangles, geometries, textures) before and after teardown, and any version assumptions left.