Info on default Mesh UV generation

Questions and answers about the how and why of making maps.
Post Reply
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Info on default Mesh UV generation

Post by JeffM »

I did some research to answer some questions about the default UV mapping for meshes. I thought I should post the answer here so others could benefit from it.

Q: What does BZFlag use to generate the default UV (texture) coordinates for meshes if the the mesh does not define any.

A: When no UV coords are defined for a mesh, BZFS will define them for you. It will first compute a plane for each face in the mesh. It will then rotate the Horizontal axis of this coordinate plane to align with the vector from the first vertex to the second vertex of the face. It will then compute the distance the horizontal and vertical axes of this new coordinate system from the first vertex to each other vertex. These distances will be used as the U (for horizontal) and V ( for vertical ) coordinates with a scale of 8 world units to one texture repeat. The map maker has no control over how this process happens, it is simply fall back logic for the case where the mesh does not define coordinates.

If you wish to control how the texture is applied to your mesh then you MUST provide UV texture coordinates for each vertex on each face of your mesh.
ImageJeffM
Post Reply