Asset Container - Hiding Mesh

if I load a model and directly hide it by placing it into a transform node that is not enabled, would it be similarly efficiently stored as a model within an asset container?

I am asking, since I need to switch fast between models. Since I have react-babylonjs to my disposal I could easily manage an array of meshes and enable the necessary ones. Now I am wondering if asset container has advantages in loading models over normal loaders?


Asset containers are using the same loading methods under the hood than normal loaders, so there won’t be any performance difference in loading time. I think asset containers benefits are that the models are not added to the scene automatically, you can add them whenever you want later on. Also, you can instantiate the same model multiple times using instantiateModelsToScene.

Thanks a lot for the information! I read about containers not appending to scene and also the instantiation. Both very useful functionalities! I guess hiding a model is less efficient to not appending to scene in terms of i.e. querying for specific objects, but there is no difference in rendering a frame, since the render engine would just ignore disabled models?
I guess I can live with enabling/disabling models in my case and will look into improvments through asset containers in the future.

Yes, there is only a very small impact on perf when disabling a mesh as a disabled mesh is thrown away very early in the processing stage.

1 Like

Thanks a lot, this is great to know :slight_smile: