#### Archived

This topic is now archived and is closed to further replies.

# Normal map from height map - there must be an easy way.

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

## Recommended Posts

Can someone who actually knows something about math come up with an algorithm to calculate the normal of a vertex in a heightmap based around the heights of the vertices surrounding it directly? All of the points are (obviously) evenly spaced. I''m sure there''s an easier way than converting it to polygons and getting normals for each polygon and then averaging them to get the vertex normals...

##### Share on other sites
Search google "finite differencing" approach. It's used by most terrain engines and bumpmap creators. Or you can just look into nVidia's heightmap-2-bumpmap plug-in (you can DL source code).

edit : I just rememberd another link.
http://www.andyc.org/lecture/viewlog.php?log=Realistic%20Water%20Rendering,%20by%20Yann%20L
and
http://membres.lycos.fr/ylmb/source/normals.cpp

You should never let your fears become the boundaries of your dreams.

[edited by - _DarkWIng_ on December 14, 2003 7:44:06 AM]

##### Share on other sites

( !x ? 0 : x-1)

EDIT: Actually a neat way of doing it though.

[edited by - coWsaRenOtevIl on December 14, 2003 11:56:29 PM]

• 9
• 11
• 22
• 10
• 14