threejs
Installation
SKILL.md
Three.js
Overview
Three.js is a JavaScript library for creating interactive 3D graphics in the browser. It provides a scene graph, PBR materials, lighting, model loaders (glTF, FBX), and performance tools such as instanced rendering. React Three Fiber (R3F) is a declarative React renderer for it, with Suspense-based loading and automatic disposal.
Versions checked: three 0.186 (r186), @react-three/fiber 9.8, @react-three/drei 10.7. Things that differ from older tutorials:
- Install from npm and import addons from
three/addons/...(for examplethree/addons/controls/OrbitControls.js); the oldthree/examples/jsm/...paths andoutputEncoding/Texture.encoding(removed in r152, nowoutputColorSpace/colorSpace) are legacy. THREE.Clockis deprecated since r182; useTHREE.Timer(timer.update()thentimer.getDelta()).WebGPURendererand node materials come fromthree/webgpu, shaders written in TSL fromthree/tsl. WebGPU renderer async methods (renderAsync,computeAsync) are deprecated since r180.DRACOLoader.setDecoderConfig()is deprecated (r185); Draco will always use WASM.@react-three/fiber9 pairs with React 19; v8 pairs with React 18.@react-three/drei10 needs R3F 9.