Sign in to follow this  

Calculating normals for vertexes in triangles

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

The canonical way is as follows.

1. Create a 'blank' normal (0, 0, 0) for each vertex.

2. Loop through each triangle. For each triangle, add the normal of that triangle to the normals of each of the three vertices that the triangle references.

3. Normalize all the vertex normals.

For each vert, this simply creates the normal as the average of the normals of all the faces incident upon it.

A more sophisticated implementation will weight the averages by the area of the faces. But you'll still get decent results without that step.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
A more sophisticated implementation will weight the averages by the area of the faces.

in fact, with triangle faces, the _less_ sophisticated implementation weight averages by area of faces[grin].
Length of cross product of two edge vectors = area of face * 2 , so you just need to not normalize anything till step 3, and you'll get nice weighted average. except i don't sure it will really looks that better.

Share this post


Link to post
Share on other sites
Quote:
in fact, with triangle faces, the _less_ sophisticated implementation weights averages by area of faces


Oh yeah, I guess you're right :-) I was just assuming he would already have normalized normals and would use those...

Share this post


Link to post
Share on other sites

This topic is 4832 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this