Jump to content
  • Advertisement


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


Question on direction of a normal.

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know that if vertices are specified anti-clockwise, then the the polygon is facing me, but in the following example where I calculate a normal, it is negative. Is it because of the way I calculated the edges? What is the correct way? I will let the vertices have the following values: V0 = (2,1,0) V1 = (0,3,0) V2 = (-2,1,0) Calculate the edge vectors from V1: E1 = V1-V0 = (0,3,0) – (2,1,0) = (-2,2,0) E2 = V1-V2 = (0,3,0) – (-2,1,0) = (2,2,0) Calculate the cross product of E1 and E2: C[x] = E1[y]*E2[z] – E1[z]*E2[y] = 0 – 0 = 0 C[y] = E1[z]*E2[x] – E1[x]*E2[z] = 0 – 0 = 0 C[z] = E1[x]*E2[y] – E1[y]*E2[x] = -4 – 4 = -8 C = (0,0,-8) Normalize the vector: VL = Sqrt (x^2+y^2+z^2) = Sqrt (0+0+64) = Sqrt (64) = 8 Normalized Vector = (x/VL, y/VL, z/VL) = (0,0,-1)

Share this post

Link to post
Share on other sites
You calculate the edge vectors wrong. Of course, you can calculate the normal using any edge vector in any direction, but only half of them will give you the right normal. In addition, to get a more accurate normal vector, you must use the same vertex as reference on both edge vectors.

(the edge vectors: (V1-V0),(V1-V2) does give the opposite direction of the normal as the vectors (V1-V0),(V1-V2))

My rule of thumb is that you use the edge vectors:
E1 = V1-V0;
E2 = V2-V0;


"The truth can be changed simply by the way you accept it."

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!