Game Development Community

UV mapping to planar texture eqn.

by A · 07/03/2006 (6:32 pm) · 0 comments

Given face or plane

vertices: Point3F v0, v1, v2, normal n, and its respective tverts: Point2F uv0, uv1, and uv2,

planar texture conversion is achieved using:

Point3F uu0(v0 + uv0.x * n);
Point3F uu1(v1 + uv1.x * n);
Point3F uu2(v2 + uv2.x * n);
PlaneF tGenX(uu0, uu1, uu2);

 
Point3F vv0(v0 + uv0.y * n);
Point3F vv1(v1 + uv1.y * n);
Point3F vv2(v2 + uv2.y * n);
PlaneF tGenY(vv0, vv1, vv2);