Material Instancing

I have a quick question about material instancing

I have a collection of textures that all come with spec, metallic, normal AO maps ect.
would it be more efficient to create a master material with a parameter for each slot and instance the other materials by swapping out the base color, normal, specular maps?
Or just create a material for each.

All of the examples i found online are very basic and only show changing the hue of the base color or increasing the glossiness with scalar parameters. I’m not sure if it’s counter productive if i’m swapping out all the maps

I’d say parameters are almost always better, even if the primary information is pulled from different maps, the fact that you are using instancing means that the engine is taking a material it’s already computed and built, and just making small changes to it. Instead of having compute mostly redundant calculations and information for a material that’s very similar in it’s anatomy.

With that being said, just making the maps into parameters will have net you so much savings. You’d be better of planning out your material and adding parameter switches to nodes that you might not need for the first instance. Usually I use use parameter switches for things like Tessellation, Displacement, AO, or any maps I don’t need now, but might want for a completely different instance later on. And use Scalar Params instead of constants whenever you’re building a parameter. I attached an example screenshot of a of a material I quickly whipped up to show you.

So I setup parameters for just about anything I could ever need in an instance. I can completely manipulate specular, roughness, (I should add one for metallic), displacement, tessellation, uv coordinates, and if I were going to keep this material, I’d add more to things like the normal map, subsurface, etc.

Because I did this, I can now use an instance of this material to not only be use for floor tiles, but maybe a wall, or a mirror, or a rock, or some rusty metal. It allows much more flexibility while keeping the material cost much lower. it also saves you the trouble of having to rebuild a similar material later in case you want one to be shinier than the other.

I hope this helps! :smiley: