# calculating face normals

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

## Recommended Posts

hi, how would you normally calculate face normals when you have the vertex normals the make up the face, I've tried adding them together and dividing by the number of vertices but it's not working, I have these unit normals: 0.577349; 0.577349; -0.577349;, 0.577349; -0.577349; -0.577349;, -0.577349; -0.577349; -0.577349;, -0.577349; 0.577349; -0.577349;, and the result is: 0.000000, 0.000000, -0.577349 but should it not be (0, 0, -1)? how would I do this

##### Share on other sites
How did you calculate the vertex normals without a face normal in the first place?

I'm unsure if you can 'revert back' to a face normal from a set of vertex normals.

But then again, I'm not the world's best mathematician.

##### Share on other sites
Quote:
 Original post by deadstarHow did you calculate the vertex normals without a face normal in the first place?I'm unsure if you can 'revert back' to a face normal from a set of vertex normals.But then again, I'm not the world's best mathematician.

there pre-calculated in .x files for each vertex but not for faces.

Quote:

thanx.

##### Share on other sites
Also, don't bother dividing by the number of vertices. Just add the vectors and normalize the sum.

##### Share on other sites
It will only be accurate (in all situations) if you make a new normal from the triangle's vertices.

##### Share on other sites
A vertex normal is computed by the normalized sum of the normals of surrounding faces if the corners are smoothed. They are identical to the face normal for sharp corners. Perhaps, before summed up, they are weighted with the enclosed angle with which the face participates on the vertex (other weighting schemes exist as well).

Summing up the normals of all verices of a face definitely considers the orientations of neighbouring faces, too. Therefore, it will definitely not yield in the original normal for the general case. If you want to yield in the correct normal, compute and re-normalize the cross-product of the difference vectors between vertices. I.e. for a face with at least 3 vertex positions p1, p2, p3 use
normalize( ( p2 - p1 ) x ( p3 - p1) )
(For quads and faces with even more vertices some possibilities exist to suffer as least as possible from numeric inaccuraries.) You can, of course, look at the vertex normals to determine whether the direction of the cross-product is correct or has to be inverted.

EDIT: Okay, jezham has mentioned it already :)

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

• 38
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631706
• Total Posts
3001833
×