Using Height Maps and Pixel Displacement- Game Dev Series 159
Objective: using Pixel Displacement to create a realistic texture surface.
One of the benefits of using HDRP is having flexibility on adjusting objects in project, includes the realistic of texture. From importing texture into HDRP project, we should notice that the basic setting of material has added lots of option that you can adjust.
In this article we will explore further on 2D texture by adding height map to present the bump of surface- the displacement mode.
We will use a realistic texture to demonstrate the following steps. In here I would use stone texture provides by GameDevHQ.
First adjust this stone texture in anyway you like.
Then we will open Photoshop or any other graphic editor to adjust this texture to create a height map.
Creating height map
Open Photoshop and import this texture.
Then from the top menu, select Filter> 3D> Generate Bump(Height) Map.
This will create the height map of this texture.
Once it shows a window to ask you checking the result, press OK.
And our height map has successfully generated.
If it is a little bit dark, you can select Image> Auto Contrast to make it looks better.
Then you can save it as a new PNG file to import to project.
Assign height map
Once you got height map in your project, select the stone material and go to Displacement Mode of Surface Options section, then select Pixel displacement.
When select pixel displacement, height map would appear as an option in Surface Inputs section.
And we can drag in the height map we just created.
Let’s check the difference after import the height map.
Base on the height map we created, it generate those bump to the surface of stone texture, which makes the stone texture more realistic and higher quality. That is the benefit of using pixel displacement from HDRP.