Skip to main content
gamedev.net
🔒 Locked

normal interpolation

Started by cignox1 0 replies 750+ views
Original Post
cignox1
cignox1
Hi, I have a point on a polygon and the normal on the vertices. How do I find the normal ont that point with an interpolation? Thank you!
Christer Ericson
Christer Ericson
Quote:
Original post by cignox1
Hi, I have a point on a polygon and the normal on the vertices. How do I find the normal ont that point with an interpolation?
Thank you!


Say your polygon is a triangle T with vertices V0, V1, and V2. Let the normals at V0, V1, and V2 be N0, N1, and N2, respectively. Finally, let the point on the triangle T be denoted P.

It so happens that P can be expressed as a weighted combination of V0 through V2 as

P = a0*V0 + a1*V1 + a2*V2

where a0, a1, and a2 are some scalar constants. In fact, the triplet (a0, a1, a2) is known as the barycentric coordinates of P with respect to T.

Assuming you know a0, a1, and a2, you can now obtain an interpolated normal N at point P by a similar weighting, namely:

N = a0*N0 + a1*N1 + a2*N2.

So, it now remains how to compute the barycentric coordinates of a point with respect to a triangle. That you can find information on just about anywhere if you google for it, so I won't repeat it here. See, for example:

http://stevehollasch.com/cgindex/math/barycentric.html
http://www.cs.caltech.edu/~mmeyer/Publications/barycentric.pdf



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.