Load glTF models as instanced mesh

How can I load glTF models as instanced meshes using the Gltfloader in Three.js? I would like to use instanced meshes for the units and buildings for improved performance.


This is for Fciv.net the 3D web version of Freeciv.
GitHub - fciv-net/fciv-net: Fciv.net the 3D version of the Freeciv strategy game

1 Like

You can load the asset in the usual way but then extract the mesh from the loaded gltf.scene and create an InstancedMesh based on its geometry and material.

Depending on how you author your scene/map, you can author your glTF with the EXT_mesh_gpu_instancing extension which means the asset itself defines objects for instanced rendering. GLTFLoader supports this extension by automatically creating an InstancedMesh for you and adding it to gltf.scene.