Planar texture mapping... I need formulas...
Well, if you''re mapping from the Y direction, you could just use the X and Z coords of the vertices for the UV coords and scale them.
For instance to map a texture onto a square in the XZ plane:
vertex[0].tu = 0;
vertex[0].tv = 0;
vertex[1].tu = vertex[1].x*SCALE_X;
vertex[1].tu = 0;
vertex[2].tu = vertex[1].tu;
vertex[2].tv = vertex[2].z*SCALE_Z;
vertex[3].tu = 0;
vertex[3].tv = vertex[2].tv;
The scalings can be whatever you want of course.
You can also calculate the tex coords based off of the normal of the plane you''re mapping.
It''s hard to provide exact formulas when I don''t know exactly what your plans are.
--Shannon Schlomer, BLAZE Technologies, Inc.
For instance to map a texture onto a square in the XZ plane:
vertex[0].tu = 0;
vertex[0].tv = 0;
vertex[1].tu = vertex[1].x*SCALE_X;
vertex[1].tu = 0;
vertex[2].tu = vertex[1].tu;
vertex[2].tv = vertex[2].z*SCALE_Z;
vertex[3].tu = 0;
vertex[3].tv = vertex[2].tv;
The scalings can be whatever you want of course.
You can also calculate the tex coords based off of the normal of the plane you''re mapping.
It''s hard to provide exact formulas when I don''t know exactly what your plans are.
--Shannon Schlomer, BLAZE Technologies, Inc.
--Shannon Schlomer, BLAZE Technologies, Inc.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement