Jump to content
  • Advertisement
Sign in to follow this  
irreversible

average normal

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

The fundamental problem I'm facing is finding the normal given a polygon, its vertex normals and a random point in the polygon - I need to calculate the normal at that point. I'm having some serious trouble doing this, so if anyone can go a little further than just providing an outline, that'd be awesome. Am I right that I need to find the primary axis plane, project the vertices onto it and use bilinear interpolation for all vertex components based on the origin of the polygon on the projected plane? NOTE: I'm not a student (this is not a school task), I'm just stupid.

Share this post


Link to post
Share on other sites
Advertisement
Assuming the polygon is convex, one approach would be to triangulate the polygon, find the triangle in which the point lies, and then compute the normal using the barycentric coordinates of the point with respect to the triangle as the weights for the triangle vertex normals. I've used this method for computing more accurate collision normals for curved patches represented by triangle meshes, and it seems to work quite nicely.

Share this post


Link to post
Share on other sites
I remember there being a paper that was linked to recently that tells you how to find general barycentric coordinates for an arbitrary convex polygon. Using all the weights might give you a better normal, since if you only choose a single triangle then your normal will vary depending on how your polygon is triangulated and which three vertex normals are chosen.

This isn't the paper I was referring to, but it does present a general construction for barycentric coordinates:
A general construction of barycentric coordinates over convex polygons

Share this post


Link to post
Share on other sites
Is that the standard approach? At first glance it seems horribly inaccurate (because it divides the polygon up, thus returning more of an estimate) given that I need this for a non-realtime application. I'll have better look at it soon, though.

Share this post


Link to post
Share on other sites
Okay - silly me, making silly assumptions. I'll have a look into this. I glanced somewhere that this is method is probably the most convenient one. Can anyone comment on the speed factor?

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!