Jump to content
  • Advertisement
Sign in to follow this  
bushman_IL

Normal Direction Detection

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

Hello,

I am not too familiar with normals so please bare with me. I have meshes that I am trying to rotate so they will lay flush along a line. To give a litle more background, these lines make up the walls of a room. so I know the center point of a room very easily. However, when I get the normal depending on which end of the wall I use first it is possible the normal could be pointing to the outside of the room instead of the inside.

So the fact that I have this normal of the wall and the center point of the room, can someone give me a little help on an efficient way of deternining if I need to flip my normal or if it is indeed pointing to the inside of the room?


I am not sure what other information might be helpful, so let me know if I am leaving anything major out to help better understand the problem I am facing.

Thank you!!

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure if this is efficient, but is it possible to take the equation of the wall/plane, say

x+y+z=3, and given the center point of the room, say (5,5,5), the parallel plane passing through the point is

x+y+z=15

Then, take the parametric equation of the normal line, and find out the respective t-values for where it intersects both planes. Based on a comparison of the two values, either increasing or decreasing, it will tell you which direction the normal is facing.

Share this post


Link to post
Share on other sites
Assuming your mesh is convex (otherwise things are not so simple) then just evaluate dot product between your normal, and (centre of room - any point on the wall) and if the dot product is positive, the normal points towards the centre of the room, otherwise flip it.

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.

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!