Using Height Maps and Pixel Displacements in Unity

How can we turn a texture into a heightmap? Let's see how!


I have a stone material placed in my scene that needs a heightmap. Normals alone do not help much as you can see below.


The image below is the albedo texture of the material.

We need to open it in Photoshop.

Once open, go to: Filter > 3D > Generate Bump (Height) map.

A window panel will pop up.

You can adjust the detail scale if you wish. I put mine to 100 percent. Our Height map will look a bit blurry with soft black and white colors.

Save your heightmap into your Unity’s project folder.

Pixel Displacement

Next, we need to setup up our material in Unity to accept a heightmap. Click on the material, and in the inspector, click on “Displacement Mode” and select “Pixel Displacement.”

It will open the option to attach a heightmap. Drag the heightmap into the box.

Now we can see the effects!

With Displacement:

Without Displacement:

You can tell that there is more depth with the heightmap. If you play around with the amplitude, you can find the perfect adjustment.

Between 1–3 of amplitude, I found best. Yours might be different depending on the texture. Displacement maps are best used on 3D planes. If you were to use them on models such as a simple box, the displacement will break it apart.

Vertex Displacement

We could also switch to Vertex Displacement to see if it adds a better look to our plane mesh.

When we switch “Displacement Mode” to “Vertex Displacement,” we have more options to play around with where “Amplitude” was located underneath Heightmaps.

It will create vertices on the plane so we can raise/lower the mesh with min/max. Down below, you can see the effect.

As you can see, it could be a nice touch for a certain area in a scene that requires more depth. I wouldn’t recommend using Vertex Displacement for all of your displacement needs but use them wisely for performance sake.





Hello everyone, My name is Gabriel Perez, I am a Unity Developer and a creator who is always learning and experimenting.

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

Recommended from Medium

What I’ve learned about coding for now

How to bring Quantum Programming for everyone ?

Best 15 updates in Dynamics 365 Sales — 2020 Release wave 1

Know your pom.xml

Live Sass Compiler extension for Visual Studio Code

Where should I begin with the Cloud?

Boost your AEM author’s experience

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
Gabriel Perez

Gabriel Perez

Hello everyone, My name is Gabriel Perez, I am a Unity Developer and a creator who is always learning and experimenting.

More from Medium

How to switch between Cinemachine cameras in Unity

Layering Materials In Unity

Cinemachine: How to create Camera Shake on Unity Cameras

Creating a Pressure Pad in Unity