Microsoft DirectX 8.0 (Visual Basic) |
Takes the color defined by the input argument as DuDv perturbation data.
texbem tDest, tSrc0
The texbem instruction transforms the u and v components by the 2-D bump environment mapping matrix, adds them to the current stage's texture coordinates, and samples the current stage's texture.
tex t0 ; Define t0 as being sampled from the texture. texbem t1, t0 ; Compute u = u1 + mat00*r0.r + mat01*r0.g, and ; v = v1 + mat10*r0.r + mat11*r0.g. ; Then sample at u,v; r0.b is ignored. mov r0, t1 ; Copy final result to output color.
This operation always interprets du and dv as signed quantities, so that the Signed Scaling input modifier (_bx2) is not required to be specified on the input argument. The texture is set at the second stage, the texture set on the first stage is ignored.
This can be used for a variety of techniques based on address perturbation, including per-pixel environment mapping and diffuse lighting (bump mapping), environment matting, and so on.
This operation is a macro of two instructions (consuming 2 stages/slots): u' = u + du*M00 + dv*M01 and v' = v + du*M10 + dv*M11 where M00, M01, M10, and M11 are D3DTSS_BUMPENVMAT00, D3DTSS_BUMPENVMAT01, D3DTSS_BUMPENVMAT10, and D3DTSS_BUMPENVMAT11.
Note that this instruction has an unnamed input which is the assigned texture that corresponds to this texture stage.