Ambient Lighting State
Microsoft DirectX 9.0 SDK Update (October 2004)

Ambient Lighting State


Ambient light is surrounding light that radiates from all directions. For information about how Microsoft Direct3D uses ambient light, see Mathematics of Lighting.

A C++ application sets the color of ambient lighting by invoking the IDirect3DDevice9::SetRenderState method and passing the enumerated value D3DRS_AMBIENT as the first parameter. The second parameter is a color value. The default value is zero.

// This code example assumes that d3dDevice is a
// valid pointer to an IDirect3DDevice9 interface.

// Set the ambient light.

d3dDevice->SetRenderState(D3DRS_AMBIENT, 0x00202020);


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.