3D Level Design: Using Layered Lit to mix Texture Maps
In this article, we are going to cover how to use the Layer Lit Shader to produce mixed Texture Maps on a game object. According to Unity’s documentation, “The Layered Lit Shader allows you to stack up to four Materials on the same GameObject in the High Definition Render Pipeline (HDRP).”
Creating A Layered Lit Material
Creating a Layered Lit Material is no different than creating a normal Material.
The Shader will need to be changed to HDRP/LayeredLit.
This will give us the ability to Layer up to four materials on one object. In this example, I am only going to layer two materials.
Unity’s documentation states, “The Main Layer is the undermost layer and can influence upper layers with albedo, normals, and height. HDRP renders Layer 1, Layer 2, and Layer 3 in that order on top of the Main Layer.”
When the two materials are assigned to their layers the top layer is the one that only appears.
For the layer materials to mix a Layer Mask will need to be added which will manage the visibility of each layer.
I am going to use the top layers displacement map as the Layer Mask, which is the brick material.
The black areas will be where the main layer will be able to come through, so you can see above there isn’t many areas hence the leaves layer (main layer) is not appearing.
We need to adjust the contrast to darken some areas, which will allow the main layer to come through.
In your photo editing software, you will want to adjust the contrast levels and compress them.
You want to make the contrast more definitive, where there are either dark or light areas. Again, the black area is wear the main layer will come through and the white areas is where layer 1 will be.
Import this new texture into the project and assign it to the Layer Mask. You can see now the leaves (main layer) are now coming through where those black areas are in the layer mask.
You still have the ability to adjust each layers properties, but remember the main layer will influence the layers above it.