   How to get UV coordinates for a point inside triangle
  HiI have a triangle in 3d space(p1,p2,p3) and a point (p) inside it and UV coordinates at the 3 corners of the triangle (UV1, UV2, UV3).I want to get the UV coordinates for point (p).input : 3d vectors : p1  ,p2  ,p3  ,p   2d vectors : UV1 ,UV2 ,UV3output: 2d vector  : UVThanks   
  Find the barycentric coordinates of the point inside your triangle.  There's lots of ways to do this, try googling around.  One way is to take the ratios of the signed areas of the triangles: {P, P2, P3}, {P1, P, P3}, {P1, P2, P} and the signed area of the original triangle: {P1, P2, P3}.  {P, P2, P3} / {P1, P2, P3} = relative weight of point P1.  Likewise for the other two.Once you have the barycentric weights of the triangle needed to form your point, apply them to the UV coordinates.  ie: UV1 * (weight of P1) + UV2 * (weight of P2) + UV3 * (weight of P3).  That will give you the UV of the point.Also note that if you're using a pixel shader, the hardware will automatically do this for you and feed teh particle shader the proper UV coords.   ;  Thanks a lot Numsgil !   