File: InstancedMesh.md | Updated: 11/15/2025
A special version of a mesh with instanced rendering support. Use this class if you have to render a large number of objects with the same geometry and material(s) but with different world transformations. The usage of 'InstancedMesh' will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application.
Constructs a new instanced mesh.
geometry | The mesh geometry.
---|---
material | The mesh material.
count | The number of instances.
The bounding box of the instanced mesh. Can be computed via InstancedMesh#computeBoundingBox.
Default is null.
The bounding sphere of the instanced mesh. Can be computed via InstancedMesh#computeBoundingSphere.
Default is null.
The number of instances.
Overrides: Mesh#count
Represents the color of all instances. You have to set its BufferAttribute#needsUpdate flag to true if you modify instanced data via InstancedMesh#setColorAt.
Default is null.
Represents the local transformation of all instances. You have to set its BufferAttribute#needsUpdate flag to true if you modify instanced data via InstancedMesh#setMatrixAt.
This flag can be used for type testing.
Default is true.
Represents the morph target weights of all instances. You have to set its Texture#needsUpdate flag to true if you modify instanced data via InstancedMesh#setMorphAt.
Default is null.
Computes the bounding box of the instanced mesh, and updates InstancedMesh#boundingBox. The bounding box is not automatically computed by the engine; this method must be called by your app. You may need to recompute the bounding box if an instance is transformed via InstancedMesh#setMatrixAt.
Computes the bounding sphere of the instanced mesh, and updates InstancedMesh#boundingSphere The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. You may need to recompute the bounding sphere if an instance is transformed via InstancedMesh#setMatrixAt.
Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
Gets the color of the defined instance.
index | The instance index.
---|---
color | The target object that is used to store the method's result.
Gets the local transformation matrix of the defined instance.
index | The instance index.
---|---
matrix | The target object that is used to store the method's result.
Gets the morph target weights of the defined instance.
index | The instance index.
---|---
object | The target object that is used to store the method's result.
Sets the given color to the defined instance. Make sure you set the needsUpdate flag of InstancedMesh#instanceColor to true after updating all the colors.
index | The instance index.
---|---
color | The instance color.
Sets the given local transformation matrix to the defined instance. Make sure you set the needsUpdate flag of InstancedMesh#instanceMatrix to true after updating all the colors.
index | The instance index.
---|---
matrix | The local transformation.
Sets the morph target weights to the defined instance. Make sure you set the needsUpdate flag of InstancedMesh#morphTexture to true after updating all the influences.
index | The instance index.
---|---
object | A mesh which morphTargetInfluences property containing the morph target weights of a single instance.