I’m afraid the way you create an instance of InstancedMesh
is not correct. You can’t just pass the result object of GLTFLoader.load()
to its constructor. I’m referring to the following line:
var mesh = new THREE.InstancedMesh( gltf, material );
You should try instead to traverse through gltf.scene
, detect all meshes and replace them with InstancedMesh
. The traverse can be done by using Object3D.traverse()
.
I also suggest you have a look at the documentation of GLTFLoader
in order to understand the gltf
result object.