#### Archived

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

# How to generate Normal averages?

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

## Recommended Posts

well, that''s a bit of a math question: i have been trying to find out how to equalize normals of adjacent triangles. in my terrain engine there are always 6 adjacent triangles (naturally), and so i have 1 normal for each triangle. now i want to build the average of those normals and use this normal for the shared vertex. all my tries to generate this normal have failed, but there is bound to be a formula for this, isn''t it? thanks rid

##### Share on other sites
Just as you would average integers: add them together and divide
(the length of the vector) by the number of normals. Or you can simply normalize it, because it''s going to be unit-length anyway.

-Jussi

##### Share on other sites
hmm, that was the first thing i tried out, and i got only results that couldn''t be right.
probably i am doing something else wrong, i''ll check my code.

thanks anyways
rid

##### Share on other sites
You should check if your triangles vertexs are ordered
clock-wise or counter-clock-wise.
if each polygon has its own order, than it MUST be the reason that your avarege normal is screwed up.
By the way, I think that what you are trying to calculate is called "Vertex Normal", but that is only a speculation of mine.

##### Share on other sites
shame on me.
i confused the normal and position vectors of my vertices and accidentally added up the position instead of the normals.
now it works perfectly.

it''s always the same, isn''t it?

ps: yes, i am calculating the vertex normals, because if i use polygon normals (i mean three normal for each triangle), gouraud shading looks really crappy

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631740
• Total Posts
3001962
×