How to generate Normal averages?

Started by
3 comments, last by Ridcully 23 years, 6 months ago
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
Advertisement
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
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
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.
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

This topic is closed to new replies.

Advertisement