Archived

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

calculating terrian normals

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

Recommended Posts

Hi there! Does anyone know a fast way to calculate terrian normals? I want to page in patches of terrain on the fly from the raw height data. This would involve calculating the normals along with the vertex positions and texture coords. Surely there must be an approximation of the normals based on the relative heights of the neighbouring vertices rather doing many cross products. Thanks in advance!

Share on other sites
you can find the formula in any calculus book in the chapter about partial derivatives and surfaces..

in case not, the idea is:

cross(h[x+1,y]-h[x-1,y], h[x,y+1]-h[y-1]);

you can simplify it a bit as you see when you write the whole thing out..

maybe this will get you a reverse normal, if so just negate it.

1. 1
Rutin
21
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 13
• 38
• 23
• 13
• 13
• Forum Statistics

• Total Topics
631714
• Total Posts
3001867
×