Instancing in glTF

Hi,

Looking for glTF models that have used “instancing” well. For e.g a “forest” or “plant” etc. It appears “instancing” should be done during content development time (blender, 3dsmax) and hopefully the exporters will carry this thru.

glTF spec itself does’nt seem to explicitly support “Instancing”. Is this right ?.

Regards
/rk

No, this isn’t correct. There are two meanings of “instancing” that are common in 3D content. The first is simply reusing meshes/materials/textures without duplicating them in the file — this is explicitly supported for any resource in a glTF file. The second is GPU instancing, a specific technique for drawing the same mesh, with the same material, many times in a scene. glTF does not mandate rendering techniques like instancing, but they’re common and may be used by engines regardless of the import format. Reusing mesh and material resources (case #1) is the a prerequisite to GPU instancing (case #2), but ultimately GPU instancing is up to the engine, not the format — engines like Unity do this automatically. Other engines may not support it at all.

In a workflow from Blender, you can use Linked Duplicates to ensure your meshes aren’t duplicated. Or use something like glTF-Transform to deduplicate binary accessors and textures after exporting, if your 3D modeling tool creates duplicates.

There is also a community extension, EXT_mesh_gpu_instancing, for explicitly indicating GPU instancing groups in a file. That’s newer, and only supported in a couple engines, but the gltfpack tool can add it to existing glTF files for you. See https://github.com/KhronosGroup/glTF/pull/1821 for some context on that.

1 Like

Don,

Thanks as always for your helpful comments. We managed to reduce the size of one of our models (potted plant) by using instancing in “3dsmax”. It reduced the exported glTF model size as well. Now I will apply some compression (gltf-pipeline …) and try.

I will also look into your suggestion wrt glTF-Transform. It appears to be the only scene-level api around. Hope it becomes a khronos standard. :-). From a programmer perspective, I tend to like the “Windows Composition Scene API” that microsoft has put together. It’s not clear from their docs wrt support for glTF though. For now its is Unity …

Regards

PS : Don, I mistakenly replied to the email msg, instead of explicitly posting here. Thanks to James for reminding

/rk

1 Like