Duplication of loaded resources

I was looking at a babylon scene that I am working on and can see that if I load an object multiple times then the associated textures within that object appear multiple times under the Textures section in the debugger. In addition I think a texture appears within this section if it is referenced multiple times within a single model file…

This isn’t surprising as I am not doing anything within code to check if a texture is already loaded.

Before I write code to resolve this, I wanted to double check some assumptions:

  1. Is there any built in optimisation at the engine level, where a texture will not be held in memory or on the GPU multiple times?
  2. Is there an existing built in tool that I could use to handle loading that will stop this duplication?

For reference, I use .babylon files (not glTF) and use SceneLoader.ImportMeshAsync to load my models.


1 Like

If the texture as the same source, it would all be loaded from our internal texture cache so it won t be dupplicated on the GPU.

So basically if the textures all targets the same underlying URL, everything should be good and actually if you look into your nerwork analyser, you should not see the dupplicated request except if loading wise you use different properties like mipmaps and such.

1 Like

Great, thanks. That’s really good to know :+1:

1 Like