Jump to content
• Advertisement

# Heighmap to Normalmap

This topic is 3627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I've been trying to find some samples for generating a normal map from and existing height map, but I cant really find anything that explains the process or any easy to understand code snippets. So I would like it if someone could expalin or point me to a good link that is easy to understand how to do this. Thank you.

#### Share this post

##### Share on other sites
Advertisement
Are you trying to do this in code or do you just have a general heightmap texture that you want to convert ot a normal map?
If so,
NVidia's Texture Tools Library has a photoshop normal map plugin.

I hope this helps!

#### Share this post

##### Share on other sites
I want to be able to do it in code.

#### Share this post

##### Share on other sites
I don't know if this can suit your needs, but I have a heightmap of which I need to calculate the vertex normals. I suppose the outcome IS a normal map after all..

The pseudo-code goes like this:

for y=0 to heightmap_cols-1 do
for x=0 to heightmap_rows-1 do
begin
normal.x = heightmap[x-1,y] - heightmap[x+1,y];
normal.y = heightmap[x,y-1] - heightmap[x,y+1];
normal.z = (heightmap_cols/2) + (heightmap_rows/2);
normalize(normal);
end;

#### Share this post

##### Share on other sites
hey that just might work. I'll give it a shot thanks.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5
• Advertisement

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633696
• Total Posts
3013378
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!