[SOLVED] Issue with GLTFLoader and reusing geometry

With the old JSONLoader it was straightforward enough to load geometry (with animations) and reuse that geometry to make any number of meshes with variable materials. Reusing the geometry is important as I cache that data in order to reduce memory footprint when I have several meshes in scene that use it.

Now that I am working to convert to the GLTFLoader I have ran into an issue. I have tried several methods of mesh creation and I can get different broken results but never the correct result.

Below is a recreation of the issue in jsfiddle. All you have to do to reproduce the error is increase the NUM_MESHES to 2 (or higher).

Please help, this is one of the last hurdles I have in order to update to the latest version of three.js.

https://jsfiddle.net/titansoftime/wdcg0zx2/

How about this: https://jsfiddle.net/be8q35n4/

It uses THREE.SkeletonUtils.clone() from this PR: https://github.com/mrdoob/three.js/pull/14494

Cloning a skinned mesh like this does not clone the geometry and material. It will be reused.

1 Like

This works!

Thank you, big time.