Home | Raytracing Reference | Help
uv coordinates provide a way to index each point on a surface (i.e. any 2-dimensional sheet). These are local coordinates and are defined in the frame of the object with the axes completely contained in the surface, however warped. An example of a uv coordinate system is the grid of latitudes and longitudes on the surface of the earth. uv coordinates are useful for mapping texture images onto arbitrarily curved and oriented surfaces. To do this, a relation between uv coordinates and texture coordinates is set up. For example, given a cylinder along the z-axis from z = 0 to z = length, we can define the u-axis to be wrapped around the circumference of the cylinder and the v-axis to be the z-axis. Thus the v-coordinate of a point on the surface is equal to its z-coordinate, and the u-coordinate is the angle through which one has to move, starting from some reference plane containing the axis of the cylinder (such as the xz-plane) to reach the point. This is illustrated in the diagram below.
If the corners of the texture are defined to have coordinates (0, 0), (xmax, 0), (xmax, ymax) and (0, ymax), then to find the point (x, y) in the texture corresponding to the point (u, v) on the surface (where v is in degrees from 0 to 360), we use the formulae
x = xmax * (u / 360)
y = ymax * (v / length)