r3f-geometry
Installation
SKILL.md
React Three Fiber geometry
Inspect installed Three.js, Fiber, and Drei versions before copying constructor arguments or helper props. Examples target Fiber 9 / React 19 and Three.js r185.
Choose the representation
- Use native JSX geometry for ordinary shapes.
argsmatch the Three.js constructor; changing them reconstructs geometry, so animate transforms rather than constructor inputs. - Use
BufferGeometryfor custom topology and buffer-basedpointsfor large particle sets. Keep generated arrays stable and use deterministic generation when results must be reproducible. - Use Drei
Instancesfor convenient declarative instances with events. For large or frequently updated sets, read native instancing to avoid per-instance React overhead. - Instancing shares geometry/material and reduces draw calls. Merely sharing a geometry among separate meshes does not batch their draws.
- Drei
Mergedcreates instancing abstractions from meshes, not BufferGeometry objects; it does not concatenate arbitrary static geometry. For actual merging, inspectmergeGeometriesfromthree/addons/utils/BufferGeometryUtils.jsand ensure compatible attributes/indexing.
Declarative instances
Mount below Canvas with lighting. Each Instance belongs to its nearest Instances provider.
import { Instance, Instances } from '@react-three/drei'