A Guild to Beautiful Game
Working with Planes and Height Maps
In this article we will explore some more settings within the HDRP pipeline that simply just change the way you can render objects within the scene.
The first thing we are going to explore is regarding to plane objects. Working with textures that should have various height or 3D elements to them such as stone works or some kind of pebbles walkways by default is always flat. But with Unity’s HDRP pipeline, you have several options to create height.
First we are going to right click on the Hierarchy and create an new plane object. Then we are going to either download the stone walkway from Filebase or insert your own 2D texture map into Unity.
Then we are going to create a new material using that 2D texture map using Unity’s HDRP/Lit pipeline.
Before we get into the fun and unique adjustments in the material settings, we are first going to drag and drop the new material into our plane as a texture setting.
The end result looks pretty decent, but it can be made even better. This is when we can start adjusting some of the options the HDRP pipeline offers.
The first easy options that we can adjust are within the Surface Inputs. The sliders for the Metallic Remapping and Smoothness Remapping all have an strong effect for the plane texture.
Just with these settings alone you can create some very amazing illusions of 3D planes. But that isn’t the final settings we can play with within HDRP. That is right we can add more to this! By using the Displacement Mode within the Surface Options we can select something called “Vertex Displacement” or “Pixel Displacement”.
To start using the displacement mode, we first need to create a height map with the help of our good old photo editor “Photoshop”.
By using the actual 2D texture image as the source, within photoshop we can create a 3D bump map image which Unity can use.
Then we can save and export the PNG file into Unity’s asset folder.
Back in Unity, once you select Pixel Displacement, within the Surface Inputs, you will see an option to place a Height Map texture.
Immediately you can see with the pixel displacement and with the added Height Map, the plane now has some 3D aspect! Although zoomed in, it looks bad but once you zoom out, the texture looks absolutely amazing! The example below is with and without pixel displacement.
The second option to displacement is the “Vertex Displacement”. This displacement also requires the Height map, but the result is totally different. Instead of using the pixels to generate height, it uses vertices generated by the height map to raise and lower the plane physically.
The setting is also different from the pixel displacement because with vertex displacement you can set the lowest height and highest height
So depending on what you need in your game, there are two very different setting to just plane displacement in making your ground more realistic!
Finally the mother of all 2D looking 3D displacements, is the HDRP Tessellation setting. Unlike the other previous two settings, Tessellation is only offered within the HDRP pipeline.
To set up the HDRP Tessellation, we are going to change the shader from HDRP/Lit to HDRP Lit Tessellation.
Then within the displacement mode, we are going to select Tessellation.
Immediately you will see your plane create a weird effects.
Just like vertex displacement the tessellation displacement works in a similar fashion where it creates vertices within the image based on the Height Map. Then with the min and max settings would lift and lower the plane accordingly.