Texture Modes

Top  Previous  Next

The Mode argument for the Set3DTexture intrinsic specifies the way in which bitmaps are applied to the mesh. Each mode has corresponding sub-modes that specify the details of how the mode works. The following modes are available:

 


 

Mode 0 =  Auto. In auto mode the program uses the Graphic Accelerator to apply the texture. Because the textures are applied by the GPU, they can be applied on the fly and adjusted automatically as the scene changes. This lets you create special effects that are not possible in other modes.

 

Sub-Modes. The following auto sub-modes are available:

 

0 = Object Linear. In this sub-mode, the bitmap is projected on the surface of the mesh from a single direction much like slide would be projected onto a screen. The image can be scaled, offset and rotated so it is projected from different directions.

 

1 = Eye Linear. Eye Linear is similar to Object Linear except that it positioned relative to the eye or camera and not the object. That means that the image doesn't move with the object, but stays at a fixed position. A result, what is projected on the objects changes depending on where the object is. The image can be scaled, offset and rotated so it is projected from different directions.

 

2 = Sphere Map. In this mode, the image is projected from all directions. Like the Eye Linear mode, the image positioned relative to the eye or camera and not the object. When the object moves, the image stays fixed. This gives the impression that object has a shiny, reflective surface.

 

Auto Parameters. Auto Mode uses 12 parameter to control the appearance of the image. They are set using the Set3DTextureParams intrinsic. Here is a description of each one:

 

ScaleX, ScaleY. These two real values scale the image that is projected on the mesh.

 

OffsetX,OffsetY. These two real values shift the position of the image up, down, right and left.

 

SPlaneX,SPlaneY,SPlaneZ,SPlaneW. These real values define one of the planes from which the images is projected.

TPlaneX,TPlaneY,TPlaneZ,TPlaneW. These real values define one of the planes from which the images is projected.

 


 

Mode 1 = Manual Mode. In manual mode, the program itself is responsible configuring the texture. Because the program has to set all the texture coordinates, they static and cannot be updated on the fly. However, since they are not applied by the GPU, more complex texture geometry can be used.

 

Sub-Modes. The following Manual sub-modes are available:

 

0 = Linear. In this sub-mode, the bitmap is projected on the surface of the mesh from a single direction much like slide would be projected onto a screen. The image can be scaled, offset and rotated so it is projected from different directions.

 

1 = Cylindrical. In cylindrical mode, the texture is projected onto the object like you would wrap a piece of paper around a cylinder. It is useful for displaying Mercator Projection maps of the Earth or other planets on a globe.

 

2 = Spherical. In spherical mode, the texture is applied to the surface of the object as though it was projected from the inner surface of sphere. It is useful for display Equirectangular Projection maps of the Earth or other planets on a globe.

 

3 = Toroidal. This mode wraps a rectangular bitmap around a toroid shape. The top of the image is projected on the inner and part of the toroid and bottom of the image is projected on the outer portion of the toroid.  It is useful for simulating toroidal objects such as doughnuts or life savers.

 

Manual Parameters. Manual Mode uses 8 parameter to control the appearance of the image. They are set using the Set3DTextureParams intrinsic. Here is a description of each one:

 

ScaleX, ScaleY. These two real values scale the image that is projected on the mesh.

 

OffsetX,OffsetY. These two real values shift the position of the image up, down, right and left.

 

ToriodRadius. This parameter only applies to Toroidal Mode. It is a real value that sets where the bottom part of the image falls on the radius of the torus. Increasing the value pushes the bottom part of the image further in the radial direction. Likewise, decreasing the value pushes bottom edge toward the center of the torus.

 

Yaw, Pitch, Roll. These three real value set the direction of the projection using Yaw, Pitch and Roll orientation model.

 


Mode 2 = Cube Map. In cube mode, six bitmap can be applied to an object from the up, down, right, left, front and back directions. This overcomes problems of distortion that occur when a texture is project from one direction. For example, when you project a map onto a globe, there is often distortion near the poles. One use for a cube map is to view it from inside an object. This gives the illusion of being immersed in a 3D environment were you can look any direction and see what you would see if you actually standing in the middle of scene. It can also be used to texture six-sided objects such as dice.

 

To make a cube map work, you need six bitmaps for the top, bottom, left, right, back and front parts of the object or scene. The bitmaps handles are stored in an integer array and passed to the Set3DTexture intrinsic in the last two arguments. For example:

 

int Cubemap(6);

 

Set3DTexture(WrkMesh,2,0, @CubeMap(0),6);

 

SubModes. The following Cube Map sub-modes are available:

 

0 = Linear. In this sub-mode, the bitmap is projected on the surface of the mesh from a single direction and from a single side much like slide would be projected onto a screen. That way,  each of the six images applied separately six side of the object. The image can be scaled, offset and rotated so it is projected from different directions.

 

1 = Reflection. This mode is similar to  Linear except that it positioned relative to the eye or camera and not the object.  When the object moves, the image stays fixed. This gives the impression that object has a shiny, reflective surface.  The image can be scaled, offset and rotated so it is projected from different directions.

 

Cube Mode Parameters. Cube Mode uses 15 parameter to control the appearance of the image. They are set using the Set3DTextureParams intrinsic. Here is a description of each one:

 

ScaleX, ScaleY, ScaleZ. These three real values scale the image that is projected on the mesh.

OffsetX, OffsetY, OffsetZ. These three real values shift the position of the image up, down, right, left, in and out

 

RPlaneX,RPlaneY,RPlaneZ. These real values define one of the planes from which the images is projected.

SPlaneX,SPlaneY,SPlaneZ. These real values define one of the planes from which the images is projected.

TPlaneX,TPlaneY,TPlaneZ. These real values define one of the planes from which the images is projected.