In this week we were focusing on the shader creation of our rocks. I wanted to experiment with the new experimental feature that was released in Unreal Engine 4.19 called Material Layers. We also needed to create rock pile assets to help smooth the transitions of the environments.
Here is the latest update:
To create the rock pile asset I sculpted some small rocks that will be used to duplicate them across the surface.
I didn't focus on creating tons of details since these will be small and also be covered with some textures on top of them.
After that was done, I created a simple model to use as a base for the rock pile.
After doing that, I created some alphas using Quixel Mixer so I could add some surface detail. I would quickly create a material and then export the height information to create an alpha brush.
I would then create a little photoshop script to automate the process of creating a blur mask to my alphas inside photoshop.
The action is really simple, I would simply create a radial gradient and then use it as a mask to isolate one part of the texture.
Here is a video showing the script in action. It can save a lot of time if you have lots of textures. I used this method to create all the alphas for the rocks.
Then I would use the Standard brush with DragRect stroke to create the details:
This is how the surface looks with some alphas:
After placing the rocks I created before this is how the final result looks:
After the High poly is done, I would use decimation master and then make some planar UVs and then relax them to avoid stretching in some areas.
Once I apply the materials, this is how it looks inside UE4:
For the material, I used Material Layers to test the workflow. I must say it really saves a lot of time once you start getting used to it. This is how it works:
- Create some Material Layers to use in your project (think of these as your material library)
- Create some Material Layer Blends to use in your project
- Use those assets to apply materials to your mesh and blend them in different ways
These layers will help you to create a big library of assets to use in your project. This is the library I created to use in the rocks:
The material setup is really simple, I would use some basic tiling features and change the roughness and albedo values. I also change the normal intensity, just in case I need it. As for the material functions, I have a personal library I use for my projects. I highly encourage you to create your own library because it can speed up the workflow by not having to create the same logic over and over. If you want, you can download my Master material for free here, you can have most of the material functions I use day to day.
The great thing about Material Layers is that you can create Instances from them, unlike Material Functions. That way you just have to create a Master material and create a huge library. This is how a Material Layer Instance looks like:
Material Layer Blends
These layer blend assets allow you to create masks that you can use to blend different layers. How you use them is up to you, they can be really simple or really complex. I created some vertex painting blends, Slope mask, and material ID mask.
This is my library of Material Layer Blends:
The vertex paint material looks like this:
I'm plugging a texture mask and manipulate the values to add some texture to the vertex painting. After this one is done, I can just create child materials and create a layer blend all the channels:
I can also change some parameters and create a new layer blend if I'm happy with the results.
The Master material is really simple. It uses the Material Layers node and blends that with a baked normal I got from the High Poly models. I don't care about how they will blend because I can change the types of blends in a Material Instance. The only thing I added is a Slope mask to put snow on top of the mesh. I got some errors while attempting to create the same behavior with material layers but it is definitely possible to create all the blends there, it happens that I deleted some assets and the system got buggy, I guess that is the price of working with an experimental feature since It worked well before, just keep that in mind.
If you are curious about the Slope mask, here is a screenshot:
After that is done, it's only a matter to play with some parameters in the material instance. This is how my Hero rock material instance looks like:
I'm using 3 layers: 2 types of rock and 1 snow layer. The first blend will use the red vertex paint of the mesh to apply the rock in those areas. The second blend will use the green vertex paint of the mesh to apply snow.
After that is done, I can just apply the same instance and modify some values for other types of rocks.
For the rock pile, I applied the same material. But this time I made a small change to the Layer Parameters. But it was really fast! Let me show you how.
The green vertex channel stays the same since I still want to have the ability to paint snow on the mesh:
But I changed the Layer 1 Blend Asset to use an ID Mask instead of the Red Vertex channel. Also, I changed the background layer to use snow instead of rock so it can blend with the ground nicely.
It really is that fast!
I made a video to show the process to create the materials. This was recorded before adding the snow layer but the process is the same.
I hope you can find some value on this, Material Layers are pretty amazing and I find them a little bit buggy sometimes so use them at your own risk, it is an experimental feature. I wanted to post the current process of the scene but I ended up making a small tutorial. I'm not entirely happy with the textures, but this workflow enables me to just create another material layer and apply it really fast to see the changes. Feel free to ask me anything if something is not clear and I will do my best to explain.
Until next time!