It is still a problem to understand such a complex approach in materials like POM and we will try to understand how to use POM thoroughly and as briefly as possible. We will also explain what each node does and why we use each of them.
Let's start with what materials are present in Unreal Engine? Materials in Unreal Engine define the surface properties of objects in your scene. A material is something like a “paint” that defines the visual appearance of an object.
What is POM? Parallax Occlusion Mapping (POM) is a complex texture-based approach to adding more detail to meshes. With POM we get more depth visually than we could with normal maps alone, because we get 3D shapes without adding extra vertices to the meshes. POM uses Ray Tracing to find the correct offsets at each point.
So why is Parallax Occlusion better than mesh subdivision?
-
It's faster than modeling because you can apply it to any mesh;
-
Easy to setup: you can do this with all textures if done correctly.
But there are also some things you should remember:
-
POM adds texel height data, separately from the normal texel data;
-
Each piece of data is ray-traced on the GPU to determine the correct visual result, addressing all of the above limitations. This provides an extremely realistic result in many viewing conditions, at the expense of substantial GPU time;
-
We still use the same textures we would use. The difference is that we also add a displacement map and some more nodes to our material;
-
POM doesn't work very well with overlapping UVs and can look ugly if you have the wrong UVs;
-
With low scalability POM will not be visible at all. You should have AT LEAST medium scalability;
-
POM is a complex function and we need many nodes which must be configured correctly, otherwise we will get artifacts;
-
POV doesn't work very well with shadow maps, so you will PROBABLY want to uncheck “Cast Shadow Map” for a mesh that you have assigned a POV material to.
So let's create a POM material. First, let's create a material. Right click in “Content browser” and select “Material”, now you should give it a name. Since it will be a master material, let's call it M_POMbricks or MM_POMbricks. The difference between “Master Material” and “Material Instance” is like between a parent and a child in programming. If a parent has some values, a child will also get them, but a change in the values of a child will not affect a parent. The connection between them is called “Parameter”.
Now we have a completely clean material and we need textures. We can create our own textures, but our main subject is POM, so right click on “Content Browser” and select “Add Quixel Content”. Find a brick material. In my case it is “BRICK WALL”. Download it.
After downloading it, open the material we created before by double-clicking the left mouse button. To get these textures, you need to select the “BRICK WALL” textures and move them into the Material Graph. Then you should connect them all like in the screenshot below.
The texture with usual colors without any light information (Albedo) belongs to “Base color”, it provides the colors we need to see in a brick wall in this case. The blue texture belongs to “Normal”, because it provides depth. But the yellow texture which we call “ARD” texture differs from the others, because it has some textures inside it in different channels, so we will use some of them. ARD = Ambient occlusion + Roughness + Displacement, that's why we connected as shown in the screenshot.
Now let's create some more nodes so we can finally have a POM effect. To create a node, right click inside the material graph and type the name of your node. Or press the palette and find the nodes you need. In the screenshot you can see the names for each node.
Constant – is a number that we will give a numerical value to. It is a small green node. Press the right mouse button and type “Constant”, then press the left mouse button on it. The names of the other nodes you can see in the screenshots below.
Let's continue. Do you see that the constant nodes have different names in the screenshots? That's because they are not just nodes, they are parameters. Now you need to right-click on them and press “Convert to parameter”, then give them a name like in these screenshots.
Now let's explore each node. What does each of them mean?
1) Channel (it is called like this because we called it like this after making this node a parameter) – it is a four-vector constant, to create it you need to write not just “constant”, but “constant4vector”. As we wrote before, this node controls which channel will be provided to ParallaxOcclusionMapping. If you remember what we wrote about ARD, then you can guess that we will use the “B” channel, which means we need to make it completely Blue, so it should be 0,0,1,0. We also used the “Add” node, because ParallaxOcclusionMapping expects us to give the value of constant4vector (that's why it says V4) and since four-vector constants have Alpha channel, we give the color (B channel) and alpha.
2)Texture Coordinate controls the scaling of the texture. Create another node and connect it to “Multiply” (this node multiplies two connected values), create another node and connect it to that one too. Now you can scale it. We need the texture coordinates and the scale depends on the scene you are creating.
3) Height Ratio (A constant vector parameter) – controls the values of our height map, in other words controls how much POM this material will be. We will write 0.3 as the default value and change it in a material instance we create, because it all depends on the textures we use.
4)Min Steps and Max Steps – Values to make the POV smooth. The more steps we have, the smoother it becomes, it's like the “Subdivision” modifier in Blender.
As you can see we have linked ParallaxOcclusionMapping to the textures, but we have also linked “Pixel Depth Offset” of both nodes. We did this because otherwise we would not have any POV effect. But again, as I said before, since we are using Pixel Depth Offset, you should most likely turn off “Cast shadow” on the actors we will be using our materials on, since they do not work very well together.
Now let's understand why we created such nodes for POM effect. Keep in mind that material instances with parameters help us to create materials and this case should not be an exception either.
At the end of this article it would be nice to add some more things that might be useful to you:
-
Texture resolution affects memory and bandwidth. They cause lag and freezes. How you handle resolution is entirely up to you;
-
If you get the warning “The current material has compilation errors, so it will not render at this time in the SM6 feature level”, you probably forgot to make the Constant4Vector node (Heightmap in the images in this article) a parameter;
Written by Alexander Mukhitdinov, Skyhell game developer, mentor and co-founder of Cube of Skill. Date: August 26, 2024. Uzbekistan. [email protected]