3D Level Design: Vertex & Pixel Displacement


In this article, we are going to cover Vertex and Pixel Displacement which will give us the ability to make flat materials appear 3D. This requires very few polygons compared to creating these dimensions in a 3D model and are prefect for terrain planes that are straight. Both of these displacements are only an option in the High Definition Render Pipeline and Lit Shader and will require the use of Normal and Height Maps.

Bump Maps

In taking advantage of Vertex and Pixel placement we will need to use Normal and Height Maps. According to Unity’s documentation, “Normal Maps and Height Maps are both types of Bump Maps. They both contain data for representing apparent detail on the surface of simpler polygonal meshes, but they each store that data in a different way.”

Height Map

Unity’s documentation states, “A height map is a simple black and white texture, where each pixel represents the amount that point on the surface should appear to be raised. The whiter the pixel color, the higher the area appears to be raised.”

Height Map

Normal Map

For Normal Maps, Unity gives the definition of a normal map being “…an RGB texture, where each pixel represents the difference in direction the surface should appear to be facing, relative to its un-modified surface normal. These textures tend to have a bluey-purple tinge, because of the way the vector is stored in the RGB values.”

Normal Map

Unity Documentation — https://docs.unity3d.com/Manual/StandardShaderMaterialParameterNormalMap.html

Our stone texture already has a Normal Map.

Below you can see how adjusting the intensity of the Normal Map can give you additional depth by representing how light should reflect off of it.

Creating a Height Map

Right-Click on the texture and either Reveal in Finder (Mac) or Show in Explorer (Windows) to locate the file. Then import the file into your photo editing software. I will be using Photoshop.

Photoshop allows you to generate either a Normal Map or Height Map using Filter > 3D.

The image is a bit dark, so we can use Auto Contrast.

This makes it a bit brighter and gives us a more detailed grey scale from darker to whiter colors which the height maps uses to determine height.

Save A Copy and appendage the file name with Height. Make sure it is saved in the same tex folder as the original file and it is an PNG.

Pixel vs. Vertex Displacement

Pixel Displacement

In the Shader, we can select Pixel in Displacement Mode.

This will give us the option to add a Height Map. Simply drag the imported Height Map here and the Height Map will be applied.

This will displace the pixels on the Mesh surface according to the Height Map and below you can see how adjusting the amplitude value gives you more depth.

Vertex Displacement

Vertex creates the displacement amongst the vertices using the Height Map. You can see below the wire frame and the vertices.

As we adjust the amplitude, texture is raised around those vertices depending on the Height Map. This does add more polygons, which is not ideal but gives you options to add bumps to flat material.


Below you can see the difference of the texture as we adjust the Normal Map and the Height Map to give more depth to the surface. The directional light is rotate around so you can see how it interacts differently with the texture.



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