Using Height Maps for Material Displacement

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.

Before and after pixel displacement

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.

Before and after Vertex Displacement

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.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Open Source and GitHub — it’s for more than just developers

Redes Sociais

CS371p Week 1/31–2/6 Blog: Tejas Karuturi

Food for Agile Thought #129

Finch’s efficient building of a streamed http response

What Is The Best Way To Explain An NFT?

TELEGRAM-LIGHT-CONTROL-BOT

GameDev : clean up Spawn Coroutine

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Calum Slee

Calum Slee

More from Medium

Creating an emission map texture

Creating a Sci-Fi Lab Room In Unity

3D Survival FPS Shooter

Using Height Maps and Pixel Displacement