PDA

View Full Version : Interpolating between vertex normals on a triangle?



halo
03-17-2006, 06:34 PM
If a point (x#,y#,z#) lies somewhere on a triangle (A,B,C), and the three triangle vertices all have different normals, how do you interpolate what the normal should be at the point in question?

Point=x,y,z

Triangle=
Ax,Ay,Az
Bx,By,Bz
Cx,Cy,Cz
Anx,Any,Anz
Bnx,Bny,Bnz
Cnx,Cny,Cnz

What should the normal be at the point (x,y,z)?

This is for a lightmapper. I need to figure out the normal at each point, so I can make the light appear smooth.

CrazyButcher
03-18-2006, 12:27 AM
google for "barycentric triangle interpolation" or just search for "barycentric" in the math forum
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=search;search_forum=6

dont forget to renormalize the weighted normals.

RigidBody
03-18-2006, 12:53 AM
http://www.t-roesener.de/LineareInterpolation.gif