What are Height Maps? Using Vertex and Pixel Displacement in Unity to Find Out

Liberty Depriest
3 min readSep 8, 2022

--

Goal: Create a height map for vertex and pixel displacement in Unity

A height map is an image that defines the highest and lowest points in an object. Normal maps, for example, are similar, in which they tell where each object in a texture which direction it’s facing.

stone texture vs stone normal map
without normal map vs with normal map

Despite the illusion that the normal map gives, there is no actual depth.

Height maps will create this 3D depth we’re looking for.

First, we go into a photo-editing software like photoshop and import the normal diffuse texture:

Then go to Filter > 3D > Generate Bump Map

Then up the contrast for this by going to Image > Auto Contrast

Now save it in the texture file of the game.

Then by going to the stone’s material, we choose pixel displacement as the displacement mode.

And then input our height map here:

And with just our default settings, we can see the pixels of our texture raised up, while still remaining a flat surface!

without pixel displacement vs with pixel displacement

Now vertex displacement is similar, but it changes the depth per vertice.

These are the vertices on our plane:

Go ahead and change the displacement mode:

And change the parametrization to amplitude:

This is what the plane looks like now:

It’s not as ideal, but this is great for making terrain meshes. By upping the amount of vertices, you can make smoother hills this way.

And that’s about it! It’s up to you which one to use! Other than that, have a great game-dev day!

--

--