Using Height Maps and Pixel Displacement in Unity — Part 02

Objective: Follow up to Part 01, focusing on building a Height Map in Photoshop and discussing Pixel Displacement Mode.

Height Map using Pixel Displacement

Similar to GIMP, the first step is to open the texture you want to edit in Unity by right clicking on the texture → Show in Explorer → Open With Photoshop.

Open Texture in Photoshop

Next step is to generate the bump map so head to Filter → 3D → Generate Bump Map → A new window will pop up, simply hit ‘Ok’:

Generate Bump Map

Now, we want to add some Contrast to the image so let’s go to Image → Auto Contrast:

From here you could look to play around with the contrast and either increase/decrease the brightness or contrast to your desired effect.

Let’s now export this file back to the same location as the one we opened it in as a PNG. Head back over to Unity and let’s set our Displacement Mode to ‘Pixel Displacement’. This will generate a new drop-down box below it called ‘Height Map’ and we will simply drag this new texture into it.

Adjusting the ‘Amplitude’ will show the bumps.

This displaces the pixels on the Mesh Surface defined by the Height Map. When using Pixel Displacement it must be used in conjunction with a flat surface.

Once this mode is selected we are provided with a range of options for setting the ‘minimum’ and ‘maximumtexture samples the HDRP uses to process the pixel displacement. We also have fading, primitive lengths and widths (of the mesh in meters) that Unity uses to apply the displacement mapping and even a depth offset. These settings will require some tweaking to get your desired effect and is different for every surface you are creating, so play around with them!

Passionate Unity Game Developer