EXT_mesh_gpu_instancing not supporting multiple geometries

Did anybody tried creating a scene with more than one instanced geometries?

I am trying to create a GLTF with instances of multiple meshes and EXT_mesh_gpu_instancing ends up writing all the instances with the correct transformations but replaces all the meshes with the first mesh connected.

If your model appears with all instances in the correct places in https://gltf-viewer.donmccurdy.com/ and https://sandbox.babylonjs.com/ then I’d recommend filing a bug with three.js, providing the model for debugging. If incorrect in the viewers, I’d file a bug with the software used to create the model.


I think the ‘Join Geometry’ node in Blender might be messing up the whole GLTF. For now, the only workaround seems to be having multiple objects of base mesh and instancing different meshes respectively on it leading to number of draw calls equals the number of objects. Still better than realising instances and creating a humongous file.

Any other ideas?

I’d recommend sharing a file (.blend?) and the complete export steps that reproduce the issue. EXT_mesh_gpu_instancing is not a feature that Blender exports out of the box, so whatever steps you’re using to apply the instancing would also be important.

test.blend (1.1 MB)
test.gltf (14.5 KB)

The steps I am following:

  1. Creating a base object (cone here)
  2. Creating two instance meshes (cube and a sphere here)
  3. Instancing them using geometry nodes (mesh to points → instance on points)
  4. Joining the respective geometries (Join Geometry node) for the final output

Some screenshots to go with

Are you sure there are no other steps here? Blender (as of v3.5) cannot export glTF files containing the EXT_mesh_gpu_instancing extension. Are you using other addons to do this?

Ahh might’ve missed that. Am using Blender 3.4.1 and thought it was able to export instanced GLTFs after installing gltf EXT_mesh_gpu_instancing IO addon. Apologies for the roller coaster. So, what’s the correct way of exporting/working around instancing from Blender?

thought it was able to export instanced GLTFs after installing gltf EXT_mesh_gpu_instancing IO addon…

If you’re using an additional addon that doesn’t come with Blender, then that’s the information I was missing. I haven’t used this addon, and couldn’t guess whether it needs to be used in a particular way, or whether it has a bug, you may need to file an issue on its GitHub repository for that.

Another way, using only “stock” Blender, would be:

  1. Following the workflow in the second half of this tutorial, enable “As Instance” in your Object Info nodes:

Screenshot 2023-03-27 at 2.29.10 PM

  1. Select the object, open the search menu, and run “Make Instances Real”. This will create a lot of objects, you may want to use a Collection.

  2. Export the scene to glTF. The file may be larger because of the many objects.

  3. Use glTF Transform to convert the reused objects to instances:

npm install --global @gltf-transform/cli

gltf-transform optimize input.glb output.glb

The model will then be loaded in three.js using THREE.InstancedMesh, instead of many objects and draw calls.

Works like charm! Thanks for the solution Don :pray: :sparkles: