Using the same material across imported meshes

Let’s say I import many different meshes with multi-materials and they have some of the same materials within the multi-materials. Eventually, the scene will have hundreds of materials, and many of them will be duplicates. Does this have a significant negative performance impact? Would it cause the scene to need more draw calls or have other negative performance effects?

If so, is there a clean way to combine all like materials into one?

Your scene won’t have more draw calls but it will consume more memory, as more materials means more memory. It’s up to you to decide you should reuse existing materials or not (try to have a look to memory consumption with a debugger).

There’s really no clean way to combine materials, the system can’t know that two different materials are really the same: you will have to manually replace some materials by others if you know they are the same.

1 Like

Understood. Thank you!

I knew they take up memory, but I wasn’t sure about the effect on CPU/GPU performance. I was looking into ways of optimizing for CPU performance and saw Deltakosh had mentioned: “Try to keep the number of materials low to avoid context switching” on a different forum post, and wasn’t sure what all negative impacts it would have.

Thanks again!