How to the Layered Lit shader to mix Texture Maps in Unity HDRP
In this article, I will show you how to mix two texture maps in Unity HDRP.
In my project, I want to mix dirt and cobblestone materials on a plane to add another layer of realism to the material.
The first step is to create the new material to use as our dual material. Go to your project tab and click the “+” button then click “Material. Name your new material (I’m calling mine Light_Dirt_Stone_mat).
Next, change the Shader to “LayeredLit” by clicking the shader button and selecting “HRDP” > “LayeredLit”.
What you will notice under the surface inputs is that you’re able to change the “Layer Count” between 2 and 4. I will only use 2 textures in this example.
Under the “Layer List” add in your layer materials. I am using the stone material as my main and the dirt layer as my next layer.
Next, add a new “Plane” into your Hierarchy by clicking the “+” button and selecting “3D Object” > “Plane” and apply your Light_Dirt_Stone_mat material to it.
The first thing to notice is our main texture is not the most prominent texture at this point, this is because we need to add a layer mask texture, this set where the second texture should render over the top of our main.
Download a texture to use as your mask or alternatively create a random noise texture in Photoshop as I’ll demonstrate below.
Create a new 256 by 256 texture.
Use the paint bucket to colour your canvas black then press “ctrl” + “a” to select everything.
Go to “Filter” > “Noise” > “Add Noise”. This will open up a window where you can adjust your Noise Level. Adjust the amount to something you’re comfortable with, set the “Distribution” to “Gaussian” and check the “Monochromatic” checkbox. I set my noise to 200% as I am going to use tiling to adjust the texture in Unity.
Export this as a png by clicking “File” > “Export” > “Quick Export as PNG” and save it to your Unity Project.
In Unity, go to your material and under “Surface Inputs” add your noise texture to the “Layer Mask” input and adjust your tiling and offset to get your desired effect.
After adjusting the texture slightly this is the final result.
That’s all for now.