Should I reuse materials if they have the same properties?

While I was coding this example, I asked myself if I should reuse the materials if they are the same, or if it is ok to create a new one every time.

In the example, I load the gltf model, iterate through all children and update the material with a metallic look. Is it ok how I did it or should I, as mentioned earlier, reuse materials which have the same properties?

If you can control it, it’s more memory friendly if you share a single material instance. However, three.js checks by default if shader programs can be shared across materials. Meaning you won’t see a difference in rendering performance.

1 Like

Perfekt! Thanks a lot!