Microsoft DirectX 8.0 (C++)

Dot Product Lighting

Dot products require signed data, so you need to convert the inputs using the _bx2 argument modifier. Lighting clamps negative values using the _sat instruction modifier.

// Diffuse is the light direction.

ps.1.0      // DirectX8 Version
tex t0      // The normal map
dp3_sat r0, t0_bx2, v0_bx2