Using Layered Lit to mix Texture Maps
Let’s take a look at a simple way to add post-apocalyptic vibes to your textures!
Objective: Learn what Layered Lit is, and how it works. and how to use it in Unity.
What is Layer Lit?
Layered Lit is a shader within the Unity High Definition Render Pipeline(HDRP), which enables the use of four (4) layers to stack materials on top of a game object to create organic mixes. The layered materials are known as Lit Materials, which simplify the process of creating realistic materials.
To simplify the term: Layered Lit allows you put a merial ontop of another material so that you can see both of them on the same object simultaneously.
You can adjust a variety of parameters to make the appearance more organic or to your liking, but the most important thing you should know is to think of the Main Layer as the base — and anything else you stack below it will be like adding details to the base. Each layer has its own set of options that you can use to adjust its appearance. If you have trouble grasping this concept, no worries! We’ll take a look at an example step by step in the next section.
How to Apply Layered Lit in Unity
For this example, I am using a grass material from Filebase and this cobblestone material.
- Create a new material, then apply it to your object.
2. While selecting your newly created material, change the shader type to Layered Lit.
Note: Remember you should be in an HDRP Project to use this shader.
3. Select the number of layers you would like to use by tweaking the Layer Count slider number. This number should be equal to the number of materials you will stack, I will set this to 2.
4. Add your base material. In this example, I want to create a cobblestone floor that has grass sprouting out of — kind of an abandoned ruin type of look. In this case, I will use the grass material as the Main Layer/base.
Note: Don’t worry if your material doesn’t display on the object just yet, this is normal and we’ll be taking a look at it at a later step.
Note: If your materials looks neon pink, click here to learn how to upgrade your material to make it usable in HDRP.
5. Add your numbered layer material. I will be adding the cobblestone material, and then adjusting parameters to make the sprouting appearance. This second material will display immediately.
6. Now, we need to make both materials display simultaneously. In order to do this, we need to use a Layer Mask. Layer masks manage the visibility of each layer by assigning a channel for each.
Black and white textures are used for layer masks, where the darker hues are filled with the Main Texture, while the lighter hues comprise the numbered layer. This black and white texture can have any sort of shape or pattern, but it is extremely useful to use the height map texture matching that of one of the pre-existing materials. This is because the height map is already tailored to represent the shape of your material of choice, making the mix much more organic.
For this example, I’m using the height map bundled with the Cobblestone texture.
I’m going for an organic, messy, and spread-out type of look, so this already looks great! However, I want to adjust some parameters a bit more to make this look as best as possible.
Adjusting the tiling: This will tile my grass material to make it look messier.
Lastly, I want to bring down the intensity of my materials just a bit. This is done by altering the Base Map.
Thank you for your time! If you found this information valuable give me a follow! :) I document my learning journey into Unity Development and Software Engineering in the form of tutorials!