Help - Search - Members - Calendar
Full Version: Texturing - Convert Normal Map to Displacement Map
Hash, Inc. Forums > Technical Direction and Development (Learning Animation:Master) > A:M Tutorials and Demonstrations > Featured Tutorials > Holmes Bryant's Tutorials/Manuals
HomeSlice
I never thought I would have to do this, but as it turns out, I just had to do this today. There are plugins to turn bump maps and displacement maps into Normal maps, but there doesn't seem to be any information on the web about converting a Normal map into a Bump or Displacement map. Soooo I thought I would write a quick tutorial. It isn't perfect, but it produces pretty good results.

* First you need a normal map. If you want to render one of your existing models as a Normal map, you can download Aaver's excellent Normal Map Plugin for AM
http://www.hash.com/forums/index.php?act=a...ost&id=8303
Also read the thread for how to use it.
http://www.hash.com/forums/index.php?showt...=16401&st=0

Render with Alpha Channel ON. This will come in handy later.
The Normal Map:
Click to view attachment

* Next open up the Normal map image in Photoshop, or your favorite image editor, and look in the Channels palette. A Normal map uses the Red and Green channels.
The Red Channel looks like this.

* Copy the Red Channel, make a new layer (not a new channel), and paste the copied channel into the layer. Name this layer "Red".
Red layer:
Click to view attachment

* Now copy the Red layer and Invert the color values on the layer by choosing (in Photoshop) Image -> Adjustments -> Invert. This reverses the image so the dark areas are light and the light areas are dark (in a color image, it would make it look like a film negative).
Name this new layer "Red Inverted".
Red Inverted Layer:
Click to view attachment

* Do the same for the Green Channel. Name this layer "Green".
Green Layer:
Click to view attachment

Green Inverted layer:
Click to view attachment

* Now you have five (5) layers in your Layers Palette (or whatever your image editor calls it). The original Normal map image is on the bottom layer. Next up is the Red layer, then the Red Inverted layer, then the Green layer, and on top is the Green Inverted layer.

* Hide the bottom layer. (the original normal map image)

What you have to do is merge the all the layers Except the bottom layer (the original image) so the darkest parts of each layer show in the final image. That is easy to do if your image editor allows you to use Blending Modes on your layers.

* Set the Blending Mode for all the visable layers to "Darken".
Here is what the result looks like.
Click to view attachment

It is a little dark, so you will want to lighten it up a bit.

* Merge all four layers (Red, Red Inverted, Green, and Green Inverted) into a single layer.

*Then use the tools available in your Paint program to lighten the image.

*Name this layer "Bump Map"
Click to view attachment

For this to make a good Bump Map, you either need to fill the background with neutral gray (128,128,128) or save the image with an alpha channel.

* Delete the background on the Bump Map layer. Leave only the figures.

* Make a new layer and fill it with neutral gray (128,128,128).

* Name this layer "Background".

* Drag this layer under the Bump Map layer in the Layers palette.

* Make sure only the Bump Map and Background layers are visible and save a TGA (with alpha channel).
HINT: You may get better results if you blur the alpha channel by 2 pixels or so.

* Now Hide the Bump Map layer.

----------------------------------------
Next is the Displacement Map:
----------------------------------------

* Make a copy of your Bump Map layer.

* Name the copied layer "Displacement 1"

* Drag the "Background" layer under the "Displacement 1" layer.

* Make a new Layer. Name this layer "Displacement 2".

* Select the outline of the figures from the "Displacement 1" layer.

* Switch to the "Displacement 2" layer and fill the selection area with white.

* Drag the "Displacement 2" layer so it is underneath the "Displacement 1" layer.

* Displacement 1" is on top. The layer order is: Displacement 1/Displacement 2/Background.

* If you want to get fancy, you can divide the image into image planes and paint each image plane a slightly different shade of gray. In the example image, I divided it into two planes (plus the Background plane).
Name this layer "Image Planes" and place it between the "Displacement 1" layer and the "Displacement 2" layer.
The layer order is: Displacement 1 (top layer)/Image Planes/Displacement 2/Background.
Click to view attachment

* Set the Blending Mode on the "Displacement 1" layer to "Hard Light".
Hard Light blend:
Click to view attachment

* Merge Displacement 1, Image Planes, and Displacement 2 into a single layer. Name this layer "Displacement".

* Blur the Displacement layer using the "Gaussian Blur" filter until you cannot really tell what the shape is. In the example image, I blurred using a radius of 15 pixels.
Click to view attachment

* Save a TGA image of this (with alpha channel).

----------------------------------------------------------------------------------
* Open up AM and make a simple box.

*Apply the Bump Map at 50% strength.
*Apply the Displacement Map at 100%-400% strength. (The appropriate strength varies widely from model to model. You have to experiment to find the value that best suits you.)
* For a little bit of extra detail, you can add another image of the bump map, but change its Type to "Color" and set the strength to 20%-50%.

Like I said earlier, it's not perfect, but it produces pretty good results ... considering.
Eric Camden
Very nice, another building block for future projects.
Luuk Steitner
That's a pretty clear tutorial, but there is an ridge around your bump map that should not be there (I think...). This is most likely because of the way you brighten the image. Like you said, the background color should be neutral gray for no displacement, but this means if the colors on the actual image drop below this you will create this ridge.
If you would use the Image->Adjust->Levels tool, and set the input levels from 0 to 128, and the output levels from 128 to 255, the colors in your image are raised to the correct level, and your background is neutral gray. No more ridge now.

This is your dark image edited my way:
Click to view attachment
HomeSlice
Thanks for the tip Luuk!
Rodney
Thanks for the tutorial Holmes!
Great information and wonderful results.

I've adapted your tutorial to PDF format and have attached it here.
I did take a few liberties with your text but hope I didn't edit too much.
Kamikaze
Thanks Homeslice (Mr Tut uncommon), Luuk and Rodney, very useful indeed and In PDF...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.