Texture Generation Format

This setting simply specifies if the texture coordinates will be generated for a two or three dimensional texture. The possible settings are TEXTURE_COORDINATE_2 and TEXTURE_COORDINATE_3 which generates 2D texture coordinates (S and T) and 3D texture coordinates (S, T, and R), respectively.

Texture Generation Mode

There are two basic texture generation approaches: linear projection or sphere mapping.

Linear Projection

With linear projection, the texture coordinates are specified with planes. For texture coordinates of two dimensions (s,t), two planes are used. The distance from a vertex to one plane is the texture coordinate in one dimension; distance to the other plane to a vertex is the texture coordinate in the other dimension. For three dimensional textures, three planes are used. The three possible plane parameters are named planeS, planeT, and planeR, where the name corresponds to the dimension for which it is used.
Each plane is specified as a 4-tuple (plane equation). The first three values are the surface normal vector for the plane. The fourth value specifies the distance from the origin to the plane along a vector parallel to the plane's surface normal vector.

There are two variations on this automatic texture coordinate generation method. The first, called object linear, produces static texture coordinates. With object linear generated texture coordinates, if the visual object moves, the texture coordinates do not change. The second option, called eye linear, produces texture coordinates relative to the eye coordinates resulting in variable texture coordinates for the object. With eye linear texture coordinates moving objects appear to move through the texture.

DEMO Texture Generation

subdirectory of the examples jar distributed with this tutorial. This is one application you should run to see the difference. The example program is written with the Generation Mode set to EYE_LINEAR. Line 100 is the place to change to OBJECT_LINEAR generation mode.

Sphere Map

If a shiny object is in the middle of a real room, the shiny object would likely reflect the image of many of the other objects in the room. The reflections would depend on the shape of the object and orientation of things in the room. The sphere map coordinate generation mode is designed to assign texture coordinates to approximate the reflections of other objects onto the visual object as would happen for the shiny object in the example real world. When a TexCoordGeneration object is used in sphere map generation mode the texture coordinates are calculated based on the surface normals and the viewing direction. The texture used for this effect must be specially prepared. If the virtual environment of the shiny object exists in the real world, a photograph of the scene taken with a fisheye lens will create a suitable texture image. If the scene does not exist, then the texture must be created to look like the image is a photograph taken with a fisheye lens.