# The problem of GLTFLoader with InstancedMesh

**URL:** <https://discourse.threejs.org/t/the-problem-of-gltfloader-with-instancedmesh/44609>\
**Category:** Questions\
**Tags:** loaders\
**Created:** [November 12, 2022, 7:40am UTC](https://discourse.threejs.org/t/the-problem-of-gltfloader-with-instancedmesh/44609 "2022-11-12T07:40:32Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [November 16, 2022, 2:16am UTC](https://discourse.threejs.org/t/the-problem-of-gltfloader-with-instancedmesh/44609/5 "2022-11-16T02:16:03Z")

</div>

If you have a GLB model that contains many repetitions of the same mesh(es) then glTF Transform can detect that, consolidate any redundant data, and (optionally) add the `EXT_mesh_gpu_instancing` extension causing GLTFLoader to create THREE.InstancedMesh objects. Typical usage in the CLI would look something like this:

```nohighlight
# install
npm install --global @gltf-transform/cli

# help
gltf-transform --help

# deduplicate and instance
gltf-transform dedup in.glb out.glb
gltf-transform instance out.glb out.glb

```

Or there’s a Node.js or Web-friendly scripting API for this too.

If you just have a GLB containing one example of the thing you want to repeat throughout the scene, though, that’s probably out of glTF-Transform’s wheelhouse. R3F is good for that, for vanilla three.js you’d have to deconstruct the scene a bit and I don’t know of general-purpose examples for that.

---

_[View the full topic](https://discourse.threejs.org/t/the-problem-of-gltfloader-with-instancedmesh/44609)._
