Camera Space Transformation (Windows CE 5.0)
To perform lighting, the transformation pipeline must be configured to transform vertices into camera space. This transformation is accomplished by multiplying model space vertex positions by the Mwv matrix.
V = Vmodel * MVW
Vertex normals are also transformed into camera space. This is accomplished by multiplying the normal vectors by the inverse transpose of the Mwv matrix.
N = Nmodel * (MWV-1)T
If the D3DMRS_NORMALIZENORMALS render state (see D3DMRENDERSTATETYPE) is set then vertex normals are normalized after they are transformed.
N = Norm(N)
Light position in camera space is computed by multiplying the light source position by the view transformation matrix.
Lpi = LpiWorld * MV
The direction to light in the camera space for directional lights, as identified by the D3DMLIGHTTYPE value D3DMLIGHT_DIRECTIONAL, is computed by multiplying the light direction vector by the view matrix. The results are normalized and negated.
Ldi = - Norm(LdiWorld * MV)
For point lights, the direction to the light is computed as the vector between the vertex and the light position.
Ldi = Norm(V * Lpi)
See Also
Send Feedback on this topic to the authors