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:
- 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?
- 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.