Model Caching

Is there a technique available to cache a model and reference it multiple times in different locations and orientations so as to not have to continue loading the model in memory? So let's say I have 5 different models, but will have thousands of instances. Has anyone done this?

Hi - not yet, but it is on the roadmap (#927). It will most likely be transparent to you, models will share the geometry/animation/skin/texture data and each instance will have separate transforms.

In the meantime, you could add some simple caching to Model.js (there is already some for animations, see ModelAnimationCache.js), but a full implementation will be a good amount of work.


I have spent a good bit of time looking into creating a deep copy of an existing model. Every time I run into an issue where model.boundingSphere is undefined. It seems like I am unsure where to make a copy that will not cause this issue.

I tried doing a deep copy after creating a model and adding it to the scene as a primitive. This did not work. Tried a deep copy during the model parse function after all the parsing was complete. This caused an error stating the gltf was undefined. Doing a deep copy in the constructor did not work, but provided no error.

It seems that once the readystate is true we get the boundingSphere is undefined error.

Any insight that you could provide would be greatly appreciated. If you need more information please let me know and I will provide you with anything I can.

See my previous post. I do not suggest implementing a deep copy. Instead, model off of the animation cache already in place. This fine-grained approach will be OK, but I expect my final implementation will cache at the model-level, not at the resource-level, but I can’t spare any time to help with it before 1.0.


has this been implemented yet?