Question regarding assetManager : loading one model several times

Hi Again

Sorry if this has already been asked.
As i know assetManager caches models, so the next time i load same model it gets a clone from cache.
but when I load the same model from assetManager for several times, does it clone the mesh for each geometry or it references all of them to one mesh in memory ?
Also what about material ?

A simple test, showed that it clones both the mesh and material for each model.
But I did another simple test, and got very interesting result.
I re-set the mesh for all models (same models) to reference to one mesh object, then played different animation on each model and amazingly animation played with no problem :open_mouth: Very cool.
But what is the reason anyway? Doesn’t each model manipulate the mesh when playing it’s own animation ?

btw, I am using Hardware Skinning.

So, think about what that means in relation to your mesh buffers.

A thought experiment, how do you suppose software skinning works? When you have a clear picture in your mind…

How do you suppose hardware skinning is different?

When you load an asset via the AssetManager, it calls clone() on the Spatial, which in turn calls clone(true) to clone the material as well.

1 Like

If the mesh is animated it gets cloned … other wise the mesh is shared but the material is always cloned by default.

Unless hardware skinning is used and then the mesh does not need to be cloned.

2 Likes