Microsoft DirectX 8.0 (Visual Basic) |
Performs a 3×2 matrix multiply on the input color vector.
texm3x2tex tDest, tSrc0
The texm3x2tex instruction takes the specified input color and calculates the dot product of the input color and that stage's texture coordinates (u, v, and w) to produce a u coordinate. Then, it takes that same input color and calculates the dot product of the input color and the texture coordinates of this stage to compute the v coordinate. Lastly, this stage's texture is sampled at (u, v) to produce the final color. No texture is sampled or needs to be set at the preceding stage, and any operator assigned to it is overridden by this one.
The following example shows how the texm3x2tex instruction might be used.
tex t0 ; Define t0 as a standard 3-vector. texm3x2pad t1, t0 ; Perform first row of matrix multiply. texm3x2tex t2, t0 ; Perform second row of matrix multiply to get a ; 2-vector with which to sample texture 2. mov r0, t2
A bump (normal) map should be set on stage 0, and a standard 2-D texture should be set on stage 2. Any texture set at stage 1 is ignored. For example, in the following shader, a base texture is lit by modulating with a diffuse bump map and adding an exponential specular. Stage 0 sets the base texture, stage 1 sets the normal map, and stage 2 sets the normal map again.
ps.1.0 ; DirectX8 Version tex t0 ; sample normal map texm3x2pad t1, t0_bx2 ; dot with light vector texm3x2tex t2, t0_bx2 ; dot with halfway vector and sample mov r0, t2
Texture coordinate set 0 positions the bump map. Texture coordinate sets 1 and 2 are the rows of the matrix.
Note that this instruction has an unnamed input which is the assigned texture that corresponds to this texture stage.