Are Layered Materials worth using

So I have been really excited about using blended materials to make a truly next gen looking level. But then I cam across this article

and at the end a caveat says

"Although Layered Materials are useful for handling multi-Material setups, care must be taken when employing them. They can be heavy in terms of performance, particularly if the Materials used in the layers are complex in themselves.

Keep in mind that all of your layers are rendering simultaneously, and then blended. For instance, if you had 4 layers in a Material, then for each pixel of your object, the system must test to see which of the four is blended, and rejecting any not in use. This added calculation makes the Layered Material more performance intensive.

Your first impulse may be to use Layered Materials any time you wish to have multiple surface types on an object. For instance, if you have a model of a car, you may want to have one Material Layer for paint, another for steel, for rubber, for glass, etc. However, many of those Materials could be separated at the geometry level. This creates more Material Elements on your objects, which increases draw calls, but is generally much more efficient. In short, if you can apply multiple Materials instead of using a Layered Material, then do so. If you must have per-pixel control over where Materials are placed, then use a Layered Material.

Although condensing multiple individual Materials down to one will reduce draw calls, the resulting Layered Material is generally going to be too heavy for this to be considered a mobile feature."

I wanted to make a level with every material being being a layered material, all of them sharing the same small library of material functions. Now I’m scared to go ahead because the caveat explains its inefficiency. I would think that instead of having many complex materials I could just have less complex materials that all talk to a small library of material functions. In the long run it would be more efficient because my sharing in the same material functions less nodes are needed in a material. But now I guess I’ll have to do things the old fashion way. Really a shame because I thought that these layered materials are what is going to make next gen games look so next gen.

Why does it have to be black and white?

Use material layers for objects that are uniquely blended and can’t be separated at the geometry level, and for assets that have multiple objects combined, just separate that into separate material IDs if necessary.

Just what makes me sad is that If I’m doing the exact same thing in this engine as the last, what will get me that next gen quality look.

Yeah it’s not as scary as it sounds and every engine to date has stated the same warning as to the over use and abuse of materials going back as far as id stating that to many shaders = a bad thing.

It’s just fair warning that if you use a material with a dozen passes using 2k materials on a 100k model you are going to have a bad day.

If you stick with procedural and physics based materials, and avoid including environment effects which are generally nasty, you can let the software in most cases handle performance issues for you.

What can get out of hand is if you are using unusually large images as your diffused map that is mapped to the same object at the sub-material level that is not procedural that the engine has no way of correcting for optimization purpose. Your kind of in that area where there is no safety net so to speak and why the need for the warning.

You can still achieve “next-gen” looks without using material layers, if what you mean by next gen is realism. And there are occasions that you cant use layered materials even if you wanted to, like if a part of the mesh needs to be translucent and the rest opaque.

@Frankie so is what your saying is to not be afraid to do this because your saying that eventually the technology will catch up.

@Jackie I wish i learned that translucent thing earlier before I spent 2 days trying push past that rule.

Nope not saying that

The tech is already there by using procedural or physics based materials and since they are value based you can let the software handle most of the optimization requirements for you.

Since you want that next gen look then it’s physics based materials you want to use as far as materials goes as there is no real practical way of achieving the result I think your after using texture based materials.

With physics materials you can do this.

I’m also saying I’ve used a lot of different engines and all of them say the same thing when it comes down to draw calls and fill rates and is nothing more than something to keep in mind because programers “know” some of the crazy things we content creators can and will do given half the chance.

Four layers in your material each with 4096 X 4096 texture images is…weellll…nuts

The good news though it takes “a lot” to break a modern game engine.

Hey guys,

I have a question regarding this. I want to use layered materials or actually rather the alternive way with multiple materials on one mesh because I do not need “per-pixel control” via masks. And when I got this right, then it is more effective NOT to use layered materials, right?
Sooo… How do I actually put multiple materials on one mesh? In my modelling-program (autodesk softimage) I can create polygon clusters and I would know how to apply materials to the single polygon clusters rather than to the entire mesh - but how do I do that in UE4?

Thanks in advance :wink:

Yay, I figured out how it works. Just for the records: It’s as simple as literally applying different materials to polygon clusters inside the 3D programm (softimage) and then exporting it to .fbx (2013er version works fine). This will create multiple material slots in the imported mesh to which individual materials can be assigned.
Thought it would be more difficult :slight_smile: