Download

Layered materials and elements

Hi all, so I’m coming into UE4 from some pretty oldschool level creation methodologies (the last time I really dug deep into the Unreal engine was way back with the original Unreal and UT), and it’s taking me a bit of getting up to speed with some of the newer ways of handling content, in particular, the use of materials on meshes, static or otherwise.

After trawling through the tutorials and videos Epic has provided over the last couple of days, I feel like I’m learning and discovering a lot, but one thing which I cannot for the life of me figure out how to do is how to layer multiple material instances over a mesh. As far as I can glean from the videos, there seem to be two differing methodologies for doing this, neither of which are in any way explained how to achieve:

The first was explained in the ‘Layered Materials’ video:

In this video, they talk about ‘using masks’, but give absolutely no indication of how the user is supposed to define or create a ‘mask’. Is it something you can set up in the editor? If not, then how can you create or apply one?

The second was touched upon in part 2 of the materials tutorial.
Here, the presenter talks about materials and meshes being divided into ‘elements’, but again, gives very little idea of how said elements are defined. Do they have to be set up in your modelling software?

I hate to be the guy who’s all like “Back in my day, all you had were five primitives, decoration meshes and flat textures!”, but the truth is I’m a bit stuck on the concept of applying multiple materials to a mesh and could really do with some help! Anybody know better than me what to do?

Masks are basically textures, which are usually created in apps such as Photoshop. They are greyscale and work like this: Black - you get the first material on the surface, white - you get the second, something in-between - you get a mix. You can store different greyscale masks in RGB channels of a texture (or even in Alpha - but this will double the size of the texture). In the Material Editor you use these channels as inputs for masks (you can find different types of pre-created material blends in the Material Editor with all the inputs already defined).

Those are called Material IDs. While with masks you have per-pixel control of what material goes where, with material IDs you can only specify certain polygons to have a certain material. These IDs are setup in 3ds Max, Maya etc… You can look at the Reflections level from the Market Place. Some of the objects will have separate elements with separate materials attached (the posters, for example).
The docs give a pretty good description of how Layered Materials work: Layered Materials | Unreal Engine Documentation Although I should admit that prior experience is required to understand them. They are not for complete beginners, but that’s understandable, as the size of the docs would be immense and very difficult to search otherwise.

There is a tutorial over creating layered materials on the wiki too:

Thanks a bunch for that, guys. That’s super-helpful, cheers!

If you are new to the mat editor I would advise to focus on the basics first, and avoid layered materials or other such advanced features. Stick to understanding the basics like blending textures together, recoloring them, animations etc.

While a slightly different interface, a lot of the UDK/UE3 material tutorials around are directly applicable to UE4 also when it comes to the basics. The concept of how you think and build up materials on a foundational level is identical, so you may want to look into that also to get some more tutorial content to work with.