Overview
BatchedMesh is Three.js's answer to a problem InstancedMesh cannot solve: drawing many objects with different geometries in a single draw call. This demo packs boxes, spheres and cones into one batched container that shares a material, then animates each instance's opacity independently and lets you toggle wireframe mode, two features that recent releases made work reliably with batching.
How it works
A BatchedMesh is created with a maximum instance count and a vertex and index budget. You add geometries to it once with addGeometry, which copies them into shared vertex and index buffers and returns a geometry ID. Then addInstance(geometryId) creates an instance that uses that geometry, and setMatrixAt(instanceId, matrix) positions it. Under the hood Three.js uses the WebGL multi-draw extension where available, so all instances of all geometries are submitted with one call.
Per-instance colour is stored in a texture. Passing a Vector4 to setColorAt sets the alpha channel too, which the material uses for transparency when transparent is enabled. That is how each object here fades in and out on its own schedule, even though they all share one material. Toggling material.wireframe applies to the whole batch, which is useful for inspecting the packed geometry.
Exploring the demo
Watch individual objects pulse in transparency at different rates while the scene still costs a single draw call. Toggle wireframe to see the mix of geometries packed into the batch. Orbit around and notice that transparent instances still need sensible sorting; BatchedMesh can sort its instances (sortObjects) to reduce blending artefacts.
When to use it
Choose InstancedMesh when every copy uses the same geometry (trees of one species, bullets, grass blades), and BatchedMesh when a scene has many different static or semi-static props that share a material, such as city furniture or modular level pieces. Benchmark the two in instancing vs BatchedMesh, learn the instancing basics in the instanced grid, and see how draw calls dominate CPU time in instancing performance.