gimp

01-29-2003, 02:51 PM

I've calculated normals like this:

CVector Edge_12 = m_Vertices[Point2] - m_Vertices[Point1];

CVector Edge_20 = m_Vertices[Point0] - m_Vertices[Point2];

CVector Normal = Edge_20.Cross(Edge_12);

m_Normals[Point0] += Normal;

m_Normals[Point1] += Normal;

m_Normals[Point2] += Normal;

However the corners that have more triangles joining with it have the normals a litle bit wrong. This is most easily seen when looking at a cube.

I recall something about weighting the normals based on the angular portion of vertex.

I can't quite work out the trig math needed however to scale the angles and portion up the normals. Anyone care to post a code fragement\link\insight to help me get started?

I check the red book and that only had unweighted normal generation, I also checked nate.scuzzy.net's normal generation, but that didn't help me either. I seem to remember something to do with taking the acos of the cross product of the two relevant ajoining lines, somethng like that.

Many thanks for any help...

CVector Edge_12 = m_Vertices[Point2] - m_Vertices[Point1];

CVector Edge_20 = m_Vertices[Point0] - m_Vertices[Point2];

CVector Normal = Edge_20.Cross(Edge_12);

m_Normals[Point0] += Normal;

m_Normals[Point1] += Normal;

m_Normals[Point2] += Normal;

However the corners that have more triangles joining with it have the normals a litle bit wrong. This is most easily seen when looking at a cube.

I recall something about weighting the normals based on the angular portion of vertex.

I can't quite work out the trig math needed however to scale the angles and portion up the normals. Anyone care to post a code fragement\link\insight to help me get started?

I check the red book and that only had unweighted normal generation, I also checked nate.scuzzy.net's normal generation, but that didn't help me either. I seem to remember something to do with taking the acos of the cross product of the two relevant ajoining lines, somethng like that.

Many thanks for any help...