DirectX SDK

Lighting State

Applications that use the Direct3D geometry pipeline can enable or disable lighting calculations. Only vertices that contain a vertex normal will be properly lit; vertices with no normal will use a dot product of 0 in all lighting computations. This means that a vertex that doesn't use a normal will effectively receive no light. For more information, see Mathematics of Direct3D Lighting.

[C++]

Applications enable Direct3D lighting by setting the D3DRENDERSTATE_LIGHTING render state to TRUE, which is the default setting, and they disable Direct3D lighting by setting the render state to FALSE.

The lighting render state is entirely independent of lighting computations that can be performed on vertices within a vertex buffer. The IDirect3DVertexBuffer7::ProcessVertices and IDirect3DVertexBuffer7::ProcessVerticesStrided methods accept their own flags to control lighting calculations during vertex processing.

Note  This render state is analogous, albeit reciprocal, to the D3DDP_DONOTLIGHT flag used in legacy rendering methods. This render state supersedes the D3DDP_DONOTLIGHT flag for DirectX 7.0. Where the D3DDP_DONOTLIGHT flag disabled lighting on a per-call basis, this render state affects all rendering calls until the state value is again changed by the application.

[Visual Basic]

Applications enable Direct3D lighting by setting the D3DRENDERSTATE_LIGHTING render state to True, which is the default setting, and they disable Direct3D lighting by setting the render state to False.

The lighting render state is entirely independent of lighting computations that can be performed on vertices within a vertex buffer. The IDirect3DVertexBuffer7::ProcessVertices and IDirect3DVertexBuffer7::ProcessVerticesStrided methods accept their own flags to control lighting calculations during vertex processing.

Note  This render state is analogous, albeit reciprocal, to the D3DDP_DONOTLIGHT flag used in legacy rendering methods. This render state supersedes the D3DDP_DONOTLIGHT flag for DirectX 7.0. Where the D3DDP_DONOTLIGHT flag disabled lighting on a per-call basis, this render state affects all rendering calls until the state value is again changed by the application.