Texture Coordinates

Texture coordinates define how an image (or portion of an image) gets mapped to a geometry. A texture coordinate is associated with each vertex on the geometry, and it indicates what point within the texture image should be mapped to that vertex.

Texture coordinates are not stored with appearance, but on each geometry individually. This allows separate geometries to share an appearance with an image texture, yet display distinct portions of that image on each geometry. This technique is common when texture atlasing is used.

u and v Texture Coordinates

Each texture coordinate is, at a minimum, a (u,v) pair, which is the horizontal and vertical location in texture space, respectively. The values are typically in the range of [0,1]. The (0,0) origin is at the lower left of the texture.

For (u,v) values outside the range of [0,1], the Texture Wrap Style property describes how this is handled.

w and q Texture Coordinates

Texture coordinates may also have optional values “w” and “q”. This is often represented as (u,v,w,q). These coordinates are both optional, so you may have, for example, (u,v,w) or (u,v,q).

w is used for more complex texture mapping in 3D space and is seen relatively infrequently in most workflows. This mapping in 3D may be in relation to 3D textures or 2D texture variations in 3D such as shadows. It can also be used with 2D textures that are intended to represent complex irregular surfaces in 3D.

w is used when rendering, in conjunction with the texture’s transformation values such as rotation, shearing, scaling, and offset. w is an extra value against which to multiply the texture transformation values, and may be used when you want to take perspective into account (such as in shadow mapping). It works the same as when you transform a location in object-space to 3D (solid) screen-space via a world-view-projection matrix. By multiplying the uvw with projection transformation values, you end up with two coordinates (often called s and t) which are then mapped onto a 2D texture.

q is used to scale texture coordinates when employing techniques such as projective interpolation. For most use cases, if a system can only handle (u,v) texture coordinates and is instead offered (u,v,q) values, a location of (u/q,v/q) may be used.

Texture Coordinate Storage on Geometries

Most FME geometries (except meshes) store texture coordinates as specially named measures on the vertices of the geometry. Both front and back texture coordinates are required, separately. The names of these measures are:

  • fme_texture_coordinate_u
  • fme_texture_coordinate_v
  • fme_texture_coordinate_w
  • fme_texture_coordinate_q
  • fme_back_texture_coordinate_u
  • fme_back_texture_coordinate_v
  • fme_back_texture_coordinate_w
  • fme_back_texture_coordinate_q

Additional Reference