Skip to main content
GameDev.net gamedev.net
🔒 Locked

Surface normals

Started by chosendl Mar 7, 2007 at 1:27 PM 1 replies 950+ views
Original Post
chosendl
chosendl
OK I want to calculate the vertex normals on my hexagonal terrain using a height map. I think that in order to do this, i need to calculate the surface normal of each of the 6 triangles that a vertex touches and then average their normals to create an average vertex normal, where the 6 triangles meet. I may be wrong in my method here, i am new to this. If anyone has a better idea, please tell me. Also how do i find a surface normal in vb.net, im sure there must be some kind of built in function for this. Thanx in advance!
Winegums
Winegums
you may find this page useful:
http://www.lighthouse3d.com/opengl/terrain/index.php3?normals
Gagyi
Gagyi
If you would have a square-based terrain, the equation would look like this:
normal.x=height(x-1,z)-height(x+1,z);
normal.z=height(x,z-1)-height(x,z+1);
normal.y=2;
normalize(normal);
(this is the average of the normals of the triangles that contain the point. Surprisingly simple.)
The hexagonal thing should be really similar, but not axis-aligned.
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.