# Calculating normals for vertexes in triangles

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

## Recommended Posts

How do you do it? I have a model loader that loads triangles.

##### Share on other sites
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 on other sites
Quote:
 Original post by jykA 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 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...

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633725
• Total Posts
3013559
×