This is one of my Master Materials. Currently almost every Material is based on it.
Is it a good approach to have a master material like this?
Let’s say I want to now some textures with Displacement.
Should I add Displacement Map into the Master Material?
Should I separate Master Materials by “concern”?
For Example:
I have currently 3 Master Materials:
Base for basic Texturing.
BaseFloor for Floor Texturing (World Position Node in the UVs)
and BaseHeightLerp for Texturing in conjunction with Vertex Painting.
Oh well … i try to avoid master materials whenever i can. They are a horrendous terrible approach on object related implementation in the unreal engine. And besides minor ressource gains, you lose an incredible amount of time into thinking about how to cover all needs within one master material. Basically an abstract abstraction which quickly becomes an abomination, far away from goals s.e. “efficiency”.
I made a master material for my project, for it’s more convenient to just define what maps you want to use and plug them into the instances than having to come up with the same boilerplate material a 1000 times.
The biggest upside: Modifying parameters on the fly without the need to recompile the same shader ever single time you change some minor setting. That’s a real time saver.
If you don’t want one complex monster of a material, split it up. One for hard surface, another for vegetation, maybe a glass, skin and a metal master material, all with their individual presets of useful parameters and you should be good.
Exactly, another reason for that is because an all-encompassing super material is likely going to have a LOT of instructions, which in the end will hinder performance to some degree.
Having one Master Material can work really well for certain types of scenes. Like Unreal Tournament’s Outpost 23. The majority of the map are those painted white structures. But even if you have more variety than that, if most of your materials are structured the same way, it may make sense to have a master material to cover the majority of your materials. Like if your game has a lot of vertex painting, you don’t want to to make make that for each modular environment piece.
You actually don’t. Just use StaticSwitchParameter to disable all non needed features. Without master materials you end up mess that you can’t update. Let say you have hundreds materials and you decide that you need new way to handle some parameter. Manually editing all those materials is pain and error prone.
And I have a bunch of standard materials, but I split them by general purpose; for instance:
Standard (standard UV mapping, optional height blending with a terrain texture, some image adjustment).
Standard Triplanar (world-aligned textures, everything else standard has)
Standard Tessellated
Standard POM
Standard Clear Cat
Standard Subsurface
Foliage
And that generally has me covered for a majority of cases. There are still a bunch of special case materials (hero shader, landscape material, etc.), but that cuts down on the pain a lot.