Microsoft DirectX 9.0

Camera Space Transformations

Vertices in the camera space are computed by transforming the object vertices with the world view matrix.

V = V * wvMatrix

Vertex normals, in camera space, are computed by transforming the object normals with the inverse transpose of the world view matrix. The world view matrix may or may not be orthogonal.

N = N * (wvMatrix-1)T

The matrix inversion and matrix transpose operate on a 4x4 matrix. The multiply combines the normal with the 3x3 portion of the resulting 4x4 matrix.

If the render state, D3DRENDERSTATE_NORMALIZENORMALS is set to TRUE, vertex normal vectors are normalized after transformation to camera space as follows:

N = norm(N)

Light position in camera space is computed by transforming the light source position with the view matrix.

Lp = Lp * vMatrix

The direction to the light in camera space for a directional light is computed by multiplying the light source direction by the view matrix, normalizing, and negating the result.

Ldir = -norm(Ldir * wvMatrix)

For the D3DLIGHT_POINT and D3DLIGHT_SPOT the direction to light is computed as follows:

Ldir = norm(V * Lp), where the parameters are defined in the following table.

ParameterDefault valueTypeDescription
LdirN/AD3DVECTORDirection vector from object vertex to the light
VN/AD3DVECTORVertex position in camera space
wvMatrixIdentityD3DMATRIXComposite matrix containing the world and view transforms
NN/AD3DVECTORVertex normal
LpN/AD3DVECTORLight position in camera space
vMatrixIdentityD3DMATRIXMatrix containing the view transform

© 2002 Microsoft Corporation. All rights reserved.