# Convert glTF to BufferGeomerty for InstancedMesh?

**URL:** <https://discourse.threejs.org/t/convert-gltf-to-buffergeomerty-for-instancedmesh/30472>\
**Category:** Questions\
**Tags:** gltf-loader, loaders, geometry\
**Created:** [October 2, 2021, 9:44pm UTC](https://discourse.threejs.org/t/convert-gltf-to-buffergeomerty-for-instancedmesh/30472 "2021-10-02T21:44:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip2809](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/philip2809/32/20390_2.png) [@Philip2809](https://discourse.threejs.org/u/Philip2809)\
**Post date:** [October 2, 2021, 9:44pm UTC](https://discourse.threejs.org/t/convert-gltf-to-buffergeomerty-for-instancedmesh/30472/1 "2021-10-02T21:44:06Z")

</div>

Hello!

I am trying to make preformance better by using InstancedMesh, and I am following the example:

> <https://github.com/mrdoob/three.js/blob/b1ede8160b5aefe18c7ec29f2af80f78b0ffd911/examples/webgl_instancing_performance.html>

But my files are glb, glTF files, not buffergeomery JSONs like in the example. My question is how do I “convert” or use the glb files in InstancedMesh?

InstancedMesh only takes buffergeomery:  
[https://threejs.org/docs/#api/en/objects/InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh)

This does not work anymore:

> [@Create BufferGeometry from GLTF Model](https://discourse.threejs.org/t/create-buffergeometry-from-gltf-model/7946):
>
> Hello, I am trying to figure out what is the correct approach for importing a GLTF model, and then accessing its information to create a BufferGeometry object for use? For example: Load GLTF Convert GLTF Model to BufferGeometry Do Something with BufferGeometry Thanks in advance! O.

I guess because the Object3D were remade or?

I found child.toJSON:  
gltf.scene.traverse( function ( child ) {  
stuff = child.toJSON();  
} );

but I can’t get a “normal” Three.buffergeomerty like the buffergeomertyloader gives me. I guess I have missed something but what have I missed?

Best Regards  
Philip

---

<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:** [October 3, 2021, 1:07am UTC](https://discourse.threejs.org/t/convert-gltf-to-buffergeomerty-for-instancedmesh/30472/2 "2021-10-03T01:07:28Z")

</div>

The [instancing / scatter](https://threejs.org/examples/?q=scatter#webgl_instancing_scatter) example ([source code](https://github.com/mrdoob/three.js/blob/b1ede8160b5aefe18c7ec29f2af80f78b0ffd911/examples/webgl_instancing_scatter.html)) might help. GLTFLoader returns a scene graph that might contain multiple meshes. Each of those meshes will already have a BufferGeometry attached to it. If there’s just on mesh then things are pretty simple, if there’s more than one you’ll need multiple InstancedMesh objects with appropriate offsets.
