I’m using an AssetContainer
to create animated character meshes and add them to the scene (GLB model, inclusive of skeleton and several animations).
I realised that creating additional character meshes to my scene was having a very negative impact on the FPS, so started looking into instancing them.
I seem to be unable to create them as instances - setting the value of options: { doNotInstantiate }
doesn’t seem to be having an effect, as the returned root mesh is always isAnInstance == false
.
The documentation for instantiateModelsToScene
reads:
Instantiate or clone all meshes and add the new ones to the scene. Skeletons and animation groups will all be cloned
Is the correct interpretation of this “skeleton and animation groups will always be cloned, rather than instanced”? If so, does that mean it’s cloning the character mesh rather than instancing, simply because it has a skeleton and animations associated with it?
I also attempted to call mesh.createInstance
on an existing character mesh and get greeted by hundreds of occurrences of this warning in the browser console: Instances should only be created for meshes with geometry.
- any idea why this is happening?
On a slightly unrelated note, are animations expensive? If I wanted to have many copies of a particular mesh playing the same animation in my scene, is there a way to utilise instancing to speed that up? What if I wanted them to play the same animation, but at different offsets? I’m guessing in this case I would simply have to deal with the extra draw calls that are required to render each mesh at their differing stages of the animation (and maybe at best, instance those meshes that are exactly in sync with each other)?