# Blender export InstancedMesh directly

**URL:** <https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769>\
**Category:** Questions\
**Tags:** blender, gltf\
**Created:** [November 8, 2024, 1:50am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769 "2024-11-08T01:50:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![XIANGYU\_MENG](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/xiangyu_meng/32/23481_2.png) [@XIANGYU\_MENG](https://discourse.threejs.org/u/XIANGYU_MENG)\
**Post date:** [November 8, 2024, 1:50am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769/1 "2024-11-08T01:50:45Z")

</div>

Hello guys, Is it possible to export instancedMesh directly to three.js scene with blender?  
I see that the `GLTFLoader` build InstancedMesh where there is a “node” type data, but I do not know how to do it.

```javascript
//GLTFLoader.js
//....
  case 'node':
          dependency = this._invokeOne(function (ext) {
            return ext.loadNode && ext.loadNode(index)
          })
          break
// class GLTFMeshGpuInstancing
//.....
 const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count)
//....

```

I’ve tried `alt+D` to duplicate or make `instance collection` with blender ,but non of them make true instancedMesh in three.js.  
And the blender extension [GitHub - takahirox/glTF-Blender-IO-EXT-mesh-gpu-instancing](https://github.com/takahirox/glTF-Blender-IO-EXT-mesh-gpu-instancing) seems not compatible with Blender4.0.

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [November 8, 2024, 2:12am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769/2 "2024-11-08T02:12:30Z")

</div>

Yes. The most recent built in blender-\>gltf exporter handles instances, and thrreejs knows how to create them on loading.  
You have to set it up carefully in blender. To make an instance of another mesh, you use Alt-D instead of Shift-D to duplicate it. that creates an instance.  
Also If the instances don’t have the same parent I think it breaks instancing.  
It might even require that they don’t have a parent, and are just in the scene.

---

<div class="post-metadata">

**Author:** ![XIANGYU\_MENG](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/xiangyu_meng/32/23481_2.png) [@XIANGYU\_MENG](https://discourse.threejs.org/u/XIANGYU_MENG)\
**Post date:** [November 8, 2024, 2:42am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769/3 "2024-11-08T02:42:54Z")

</div>

Hi, I’ve tried Alt-D to duplicate a simple cube, but failed with or without same parent.I must have missed some thing 😂

---

<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 8, 2024, 3:00am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769/4 "2024-11-08T03:00:23Z")

</div>

A quick check to see if your glTF model is set up for GPU instancing would be:

```javascript
gltf-transform inspect scene.glb

```

If you see `EXT_mesh_gpu_instancing` listed near the top of the output, under `extensionsUsed`, then your glTF export should generate at least one InstancedMesh in three.js.

There are two relevant options in the Blender exporter settings, probably “GPU instances” is the simpler one to use. Both should result in similar exports, but require differing setup in Blender.

 ![CleanShot 2024-11-07 at 21.59.16@2x](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/4/a/4a8f9bdc202ba1d3f0eb7ccb688acf7dd725fdec.png)

Alternatively, if you can’t get instances working directly, post-processing with gltf-transform can add them for any identical meshes in the scene:

```javascript
gltf-transform optimize in.glb out.glb --instance --instance-min 5

```

---

<div class="post-metadata">

**Author:** ![XIANGYU\_MENG](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/xiangyu_meng/32/23481_2.png) [@XIANGYU\_MENG](https://discourse.threejs.org/u/XIANGYU_MENG)\
**Post date:** [November 8, 2024, 3:26am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769/5 "2024-11-08T03:26:41Z")

</div>

Hi, I’ve managed to export instancedMesh by using `GeometryNode Editor` and fix install extension `glTF-Blender-IO-EXT-mesh-gpu-instancing` via [Patch 1 by jrjdavidson · Pull Request #16 · takahirox/glTF-Blender-IO-EXT-mesh-gpu-instancing · GitHub](https://github.com/takahirox/glTF-Blender-IO-EXT-mesh-gpu-instancing/pull/16)  
And i just saw my blender version is 3.6.1 🤣 so there is no “Scene Graph” option in exporter. I will upgrade and figure it out.  
Thank you so much ❤

---

<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 8, 2024, 3:30am UTC](https://discourse.threejs.org/t/blender-export-instancedmesh-directly/73769/6 "2024-11-08T03:30:46Z")

</div>

I think with newer Blender (I tested v4.2, but maybe older versions too…) there’s no need for an additional extension, the built-in one can handle instances. Good luck!
