Memory usage of material instances?

Hi guys,

I’m an environment artist, currently spending most of my time developing for the Marketplace. I’m trying to expand my ‘under-the-hood’ understanding of the engine to help me design more efficient asset packs.

In my current project, I have a collection of fairly complex (some very complex) shaders that I’m using as parent materials for all the texturing. Specifically, I have a master wood/metal material that I’m using for 90% of the geometry.

I’m just curious what the memory trade-off is between scenario a) creating many different simple materials for specific use (let’s say, 20 different materials) vs b) creating a single master material with multiple material functions that can be switched off and on - which acts as a parent for 20 different instances instead. (Mind you, I’m still having to load in a set of RGB masks and a normal map for each material instance, so there is definitely extra texture being used per each instance).

Does it all come out in the wash? Is one approach a better practice, memory wise? Or just personal design preference?

Thanks!

Static switches are factored at compile time, so any code/nodes that follow a disabled branch are completely masked out and will have no cost.
If your master material gets too complicated, it may defeat it’s purpose as a workflow enhancement tool but if it’s built properly I don’t think you’ll see any performance drawbacks. Each new material, or material instance is a draw call regardless.

Memory/file size is what matters