"SparkoMat", Dave's Universal Unreal Engine Master Material
I spent some significant time developing this Uber master material, primarily so I could use all the content I’ve downloaded over the years and not be forced to use each artist’s unique master material they created for their assets. In a typical scene where I might use a lot of free, downloaded content, I might end up with 10 Master materials for stuff that essentially uses all the same material creation methodology. There’s only so many ways to make a general material in UE. But each artist seems to implement their use of textures differently, Masks in Alpha, masks in Red channel, Roughness in Green Channel, etc. And sometimes different UV Channels based on the object. I have a recent scene where I’ve used downloaded content (free and purchased) from more than 20 different artists. It’s all been adapted with my single master, and yes, I lost a few subtle parameters in some of the more complicated materials they set up (like extra detail texturing on a few rocks) but otherwise, my Master and it’s sister for vegetation have worked like a charm. One Master for a gigantic, complicated scene makes me feel good😊.
By default, Unreal doesn’t allow you to turn the choice of UV channel number into a variable. So using a Material Function, I set up my master to allow you to choose up to 5 different UV Channels (0-5) and pick any RGBA from any texture for use in any parameter. I also added parameters for a lot of the general adjustments I found I needed (Contrast, Output, Saturation, Flip Normal, etc.). My workaround to the UV limitation was to do it and several other parameters via Material Functions. The process of choosing different UV’s in the Instance is a simple process of elimination on some checkboxes, if not 0 then 1, if not 1 then 2, etc. Same with RGBA choices (for masks and RMA’s mostly). In the link below is a simple project done in 4.27, exclusively to include the Master Materials for you to check out. Attached is a screen grab of the material graphs (hard surface and vegetation). Very similar and relatively straight forward.
SparkoMat sample scene ~360 MB
The sample scene includes a small terrain using an aerial photo. But in addition, I've used Mesh Paint to add detail via the RGBA paint options. You'll find a sample material using Material Attribute Blend options to create a more detailed ground surface suitable for walking around on, similar to the effect you get from Landscape Materials but on a Static Mesh terrain model. Obviously the Landscape system provides superior results for texturing but really isn't viable for accurate reproduction of a real-world existing location at ground level. This material uses some of the same Material Functions as the SparkoMat Master Material. Below is a capture of the Blend graph for the grass material on the terrain. It's output leads into a Blend node for combining the other RGBA components. I'm not sure, but I believe using the Material Functions in this way helps avoid the 16 texture samples limit as well. Though still limited by the 4 channels of RGBA in Mesh Paint, you can take any one of those channels and make it quite complex using the workflow I've offered here.
There are any number of ways to create a complex material in UE. I'm just offering up mine here as one option. Those with more experience (that's most of you) likely have your own approach to blending materials and implementing them inside of Mesh Paint.