Question

I need to calculate normal vector for a triangle prepared for passing to opengl chain. It has vertexes enumerated in counter-clockwise order that is default for opengl. Let denote them as A, B, C, and put C-B as u and B-A as v.

In what order should I cross product vectors to gain normal vector codirectional with the normal calculated by internal opengl procedures? v × u or u × v?

I've found many topics about face-culling and vertex ordering, but not about computation normals for triangle that depends from vertex order as well as from the coordinate system orientation.

Was it helpful?

Solution

Use the Right hand rule, assuming your triangle is A,B,C in CCW order. then you need

Normal = Cross(B-A, C-A);

The way you set u,v and is inconsistent both vectors should have the same tail it's more consistent this way.

If you want to use u,v the way you set, it is v x u using right hand rule.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top