| Texture Mapping|
(0=addresses, 1=vertices, 2=faces)
(0=flat, 1=cylinder, 2=sphere, 3=chrome, 4=lens)
X coordinate of projection center
Y coordinate of projection center
Z coordinate of projection center
rotation of projection around Z-axis
rotation of projection around X-axis
rotation of projection around Y-axis
horizontal origin of texture
vertical origin of texture
horizontal decrease grade of texture
vertical decrease grade of texture
By means of the texture mapping
command one can determine in which way a texture is laid on an object. This command cannot substitute the precise manual texture positioning, but in many cases it can provide a sufficient means for fast automatic texture mapping. This command is useful for an active operation stage
of an active object
parameter determines by which method a texture will be mapped on the object. The default setting is 0
- texture address mapping. When mapping addresses, each vertex will receive the horizontal and vertical coordinate (typically ranging between 0 and 1) of a certain place in the texture. Using this method it is not necessary for the texture to be present in the object during the mapping operation. Each operation stage can possess its own address mapping. If some stage does not contain any texture address mapping, then the mapping result from the foregoing stage will be used. Each newly created object
contains a default texture mapping for stage 0.
Another two methods are: 1
- object vertex mapping, and 2
- object face mapping. These two methods set each vertex or face of an object to the color that is found in the corresponding texture location. Therefore, in the moment of mapping the texture must be set for the object's active stage, the picture of which will be used for the color mapping. When mapping vertices, a color is assigned to a particular object vertex. The color grades continuously between the vertices (A precondition is the object smooth shading
being switched on). When mapping faces, all vertices of individual faces are set to the same color. There are sharp transitions between individual faces. After the vertices or object faces being mapped the object texture that has been used is unloaded automatically, and the mode of object internal colors
is set. Object vertex and face mapping may be a suitable replacement for using several textures and light maps. After the colors have been mapped the object can use another texture in a common way. For the DirectX 3 though Direct 6 interfaces the vertex and face colors can be used only when the object lighting
is switched off.
When mapping a texture, the texture coordinates are calculated in a similar way as if the texture were projected onto the object vertices. The kind of projecting is defined by the projection type parameter. The default projection type is 0 - flat projection. During flat projection the texture is projected as a flat area. In the default setting the texture is projected in the Z axis direction. The horizontal and vertical coordinate of a point lying in the texture is at the same time the X and Y coordinate, the projection being independent of the Z coordinate. The second projection type is 1 - cylindrical projection. In this projection the object is enwrapped by a cylindrical surface, the Y axis being the projection cylinder axis as the default setting. The texture's vertical coordinate is at the same time the Y coordinate, the horizontal coordinate is linearly dependent on the horizontal angle of the projecting beam. The projection does not depend on the distance from the projection axis (The Y axis as a default setting). The third projection type is 2 - spherical projection. In this projection the object is enwrapped by a spherical surface. The coordinate system origin is the projection center as the default setting. The projection is independent of the distance from the projection center. Especial cases are 3 and 4 projections, chrome and lens projections. These projections are automatic generated projections simulating reflection of environment on the object.
The X-Y-Z coordinate of projection center parameters enable to change the projection center. In the default configuration the projection center is identical with the coordinate system origin.
The rotation of projection around Z-X-Y axis
parameters enable to turn the projection direction. The projection rotation sequence corresponds to the parameter sequence: Rotation around the Z axis, X axis, and finally around the Y axis. For example, during the flat projection the texture is projected in the Z axis direction (default camera view). When mapping a terrain
, the projection must be rotated to view "from above", therefore the rotation around the X axis must be set to 1/2 pi
(i.e. 90 degrees).
The origin of texture
parameters make it possible to shift a texture in horizontal and vertical direction. These parameters determine which texture point should be considered to be the origin (The texture coordinates are 0 till 1). The default values are 0.5; during a mapping on the wall
, the wall's beginning and end will coincide with the texture's beginning and end.
The decrease grade of texture parameters determine how many times a texture will be minified in the horizontal and vertical direction, the default setting being 1. For example, at a "decrease grade of texture" parameter of 2 the texture will be projected twice in the horizontal and vertical direction on a wall having a unity size.
In using the "addresses" mapping method the texture repetition
mode is switched on automatically, if the clamp mode is set.
Full Html Context Help of The Peter - Gemtree Software & Children Programming