Parallax Occlussion Mapping is a very nice effect that lets you simulate “real” elevation details on your materials without actually modeling those elements (for example, simulate sunken parts of the object). This effect can also yield a better result than regular normal maps since it actually offsets the pixels of your model rather than simulating the details using normals. Obviously, the end result is not really as good as actually modeling the detail, or adding a displacement map, but these last two options are more hardware-demanding since they render actual geometry. In this article I am going to show you how I did this effect for a wall in Killer Dolls Battle Arena.
For this effect, I used regular textures created in Substance Designer. I created the regular maps, but I also exported a height map (I always ignore this map when I am making my materials).
The material in UE4 is created just like any other material. The only difference is I added a color node to the material so I could change the tint of the walls inside the engine.
Now this is the interesting part. There is a node in UE4 that lets you do this parallax effect. The node looks somewhat complicated, but it’s easy when you understand it.
Basically this is what you have to do. You need to create a Texture Object and connect it to the first input of the node. The Texture Object must reference your height texture. Then, the height ratio is basically the amount of depth applied to the material. You should use low values because, since this is a simulated effect, high values can produce unwanted results. The next two parameters are basically the quality of the effect. The heightmap channel defines what channels are used for the effect. Height maps must use the alpha channel, so just do the connection I did in the image. The light vector tells the object where light comes from. I simply used a regular vector, but you could also calculate the light direction using material nodes. The last ones are shadow parameters.
You then use the results of this big node like this: You output from the UVs to the UV coordinates of your other textures (imported into the material as Texture Samples, not Objects), and the pixel depth offset is connected to the material’s pixel depth offset input.
The result is what you see in the image below. As I said before, it’s a simulated effect, not something that actually moves polygons.
As comparison, this is the same wall without the effect.
And also for comparison, this is the same wall with a higher height ratio value. As you see, the effect is more pronounced, but you start to get artifacts on the edges of the mesh.
And that’s it. I hope this tutorial was useful.