Archived

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

calculating terrian normals

This topic is 5401 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

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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites