In Unity to create more detailed textures
One of the new surface inputs included with the High Definition Rendering Pipeline (HDRP) is Height Mapping (or Parallax Mapping). Height mapping is similar to our normal mapping, in that it allows for extra definition on a flat surface. Whilst normal maps modify the lighting of the surface, height mapping allows us to go a step further and manipulate areas of the surface around. This allows us to render what appears to be bumps and protrusions, but still keeping the original polygon model!
Heightmaps are made from a greyscale, with lighter areas representing height, and darker representing lower areas. Sometimes, our texture won’t have a height map included, and if we don’t know how to make our own, the normal map can often work just fine!
To enable a Height map input we first need to choose our Displacement mode within our Shader properties. Here, we can choose either our vertex or pixel displacement. Whilst vertex displacement manipulates the mesh’s vertices, pixel displacement simply manipulates the pixels of the texture.
Pixel displacement is our simplest form of displacing and manipulating textures based upon height maps.
With our pixel displacement mode selected, we gain a number of properties, as well as a new texture input for our created Height Map. Adding this, allows us to start manipulating our surface via the Amplitude parameter.
Under our Displacement Mode selection, we also see various other parameters we can use to adjust how our Height Map works. These allow us to set the scale of how much displacement occurs, through step heights and area size.
Alternatively, we can use Vertex Displacement, which directly manipulates the individual vertices of the object, this can easily be seen using the Selection Wire gizmo.
Selecting Vertex Displacement, gives us different variables to that of Pixel Displacement. By default, we see a Parametrization parameter set to MinMax. To gain a similar handle to Pixel Displacement, we can change this to Amplitude, and manipulate the material this way, whereas our MinMax mode allows us to compare two values to find the different positions for each vertice.
These two methods of Displacement, allow us to achieve different results as required, with Pixel Displacement appearing to add depth, whilst Vertex Displacement appears to mold the surface itself to be much more rugged.
Either way, it’s a much more achievable way to add detail using a flat surface as opposed to trying to 3D model the detail in, as this can result in using more rendering power.