Jump to content
  • Advertisement
Sign in to follow this  
Badams

Transform After Normalizing

This topic is 3665 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

Greetings, This has been driving me crazy. I've got a triangle set up and have calculated the Normal Vector for it. I translations, rotations, and scales going on, but one of them is messing up the original normal vector. My guess is that it is the rotations, mainly because the face of the object will be pointed in a completely new direction. I almost feel dumb asking this. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You're correct. Rotating a triangle can point it in a new direction, changing its normal. Remember what a normal is: a vector that points in the direction that the surface faces, and has length 1.

Scaling and translating a triangle cannot affect its normal. Think about stretching or moving a triangle laid flat on the ground. No matter where you move it or stretch it, it's still flat on the ground, and so still facing in the same direction and still has the same normal.

EDIT: jdindia is right, applying a scaling transform in general can affect the normal too. I was thinking only of uniform scales. If your scale is uniform, then scaling by a positive won't affect the normal, and scaling by a negative will flip the normal (make it negative).

[Edited by - Melekor on November 30, 2008 3:20:02 AM]

Share this post


Link to post
Share on other sites
Scaling will definitely do it if it's not uniform and not corrected.

Also, you have to apply the appropriate transform to the normal vector. You don't treat it like a vertex. OpenGL and DirectX take care of this for you, unless you're writing a shader.

http://www.lighthouse3d.com/opengl/glsl/index.php?normalmatrix
gives an explanation of this.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!