Strange textures

I wonder why there are two materials here.

Size Plane Based on Dynamic Texture | Babylon.js Playground (babylonjs.com)

image

when I use babylon.js, there are always a lot of textures(materials too).

What should I do with them, or the engine will handle it.

You dispose material instead of disposing the temporary texture.
In this example - https://playground.babylonjs.com/#TMHF80#1689 - everything seems to be correct.

2 Likes

scene.removeTexture(temp) can also be done, does it make any difference ?

The difference is that with scene.removeTexture(temp) it is not removed from memory, and you are able to call it later with scene.addTexture(temp).
For your case I believe it is better just to dispose the temporary texture completely and free some memory since you don’t need temporary texture anymore.
Of course, it may depend on your use case.

1 Like