TypologySienna Chen
LookMiddleweight

Instancing

One shape drawn thousands of times, cheaply.

Drawing one shape thousands of times in a single stroke, each copy in its own place. Ten thousand leaves, a field of cubes, a crowd of dots, all at 60 fps. The look is repetition with small differences.

Breaks when
per-instance updates on the CPU become the bottleneckraycasting needs extra setup
Also called
InstancedMesh, GPU instancing, instanced attributes

Prompts

Field of ten thousand
Three.js InstancedMesh: 10,000 IcosahedronGeometry(0.05, 0) instances placed on a 100×100 grid with jitter, one MeshStandardMaterial. Per-instance color from a mint-to-yolk ramp by distance from the center via instanceColor. Animate only in the vertex shader: patch the material with onBeforeCompile so each instance bobs by sin(time + instanceMatrix[3].x). Instance matrices are written once. Confirm renderer.info.render.calls === 1.
Instanced text particles
Rasterize the word “instance” to a 240×60 canvas, sample lit pixels into positions, and render them as an InstancedMesh of 0.02 boxes. On hover, instances within 0.5 units of the pointer ray scatter outward with a spring back (damping 0.85), updated on the CPU only for the affected instances (keep a dirty set; setMatrixAt only for those; instanceMatrix.needsUpdate once per frame).
Raycast instances
Add pointer picking to an InstancedMesh of 5,000 cubes: use Raycaster with instanceId, highlight the hit instance by writing its color, and show its index in an HTML label. Keep the raycast under 2 ms by giving the mesh a bounding sphere and skipping frames when the pointer has not moved.

Related

Resources · 2