converting NormalMap to HeightMap

3c6597370b476903ed475f70b4b3ce31
0
john 102 Jan 02, 2005 at 05:06

Is there a way to convert a normal map to a height map? I found a paper on this, but it talks about an iterative method. Has anyone found a direct method?

3 Replies

Please log in or register to post a reply.

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 Jan 02, 2005 at 10:11

If you’re using directx you can use the D3DXComputeNormalMap function, otherwise, here

3c6597370b476903ed475f70b4b3ce31
0
john 102 Jan 02, 2005 at 18:45

Oops, stupid typo. Thanks for your answer. I meant NormalMap to HeightMap, but I wrote it the other way around.

So, now that I fixed the typo, is there a way to convert?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jan 03, 2005 at 04:40

It seems to me you could just start at the upper-left corner and add offsets calculated from the normal map values as you move right and down. Just the opposite of the way normal maps are calculated from height maps (by taking differences between adjacent elements).

You would want to do it in floating point, keeping track of the maximum and minimum height reached, and then scale to [0, 255] range when done.

I don’t know how accurate this would be at reproducing the original height map. Might take some tweaking.