Texture transformations

By transforming the texture coordinates assigned to a facet’s vertices, we control how the texture gets mapped to the facet. Transformations applied to texture coordinates have an inverse effect on the image’s appearance. For example, scaling the texture coordinates by a factor of 2 in both directions effectively shrinks the image by a factor of 2, so the texture gets repeated twice in each direction across the facet. For example, translating the texture coordinates to the right effectively shifts the texture image to the left by an equal amount.

We can see the effect of such transformations through a window into texture space. This device works as long as scaling is uniform, the same scale factor in both directions. In the following program, the left panel shows the effect of transformations on the window into tiled texture space, and the right panel shows the resulting appearance in the square facet. Use the GUI to set transformation parameters.

Window into textures

The window includes a small red sphere marking the center of rotation and scale operations. At one corner of the window, the window’s red border meets its green border. This corner corresponds to the lower-left corner of the square facet (right panel), where the red border corresponds to the facet’s bottom edge and the green border to its left edge.

The following program lets you apply different textures to different geometries. The texture coordinates (s,t) can be transformed as the previous program with one exception: The following program lets you scale textures nonuniformly by setting different values to wrapS and wrapT.

Transforming textures