THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/06/2005 at 00:06, xxxxxxxx wrote:
Well, here's the response that I received. If more information is needed, at least a search of 'barycentric' and 'bilinear' may provide more information.
_I have a solution for triangles, that may be enough for you. The true answer for n-sided polygons depends on the method your renderer is using to interpolate the UV coordinates. For triangles, barycentric is the most common, and for quadrangles, bilinear is common.
Anyhow, here's what I did when I needed to do this for triangles. I'd either assume that P is in the plane defined by the triangle, or project it to that plane. Then I'd have the vertices of the triangle ABC, with P in the triangle. I'd compute the area of the 3 triangles ABP BCP and CAP. Then the barycentric coordinates of the points A B and C are the areas of the opposite triangles, divided by the sum of the areas. In other words, bary(A) = Area(BCP)/(SumOfAreas). Then use barycentric interpolation of the UVs to find the correct interpolated UV coordinate of P._
And I agree with David that if you want to use a simple triangular method, best to subdivide n-gons into triangles (very easy) and go from there with Barycentric interpolation.