DirectX SDK

Light Color Types and Sources

Light sources in Direct3D emit diffuse, ambient, and specular colors as distinct light components that factor into lighting computations independently of each other. (Note that this is a departure from the light model employed in versions of DirectX prior to DirectX 7.0, which used a single light color for all lighting calculations.) Similarly, the vertices that the system renders can use discrete diffuse, ambient, specular, and emissive colors, as defined by their vertex format.

[C++]

For a C++ application, these vertex colors are used by the system only when you set the D3DRENDERSTATE_COLORVERTEX render state to TRUE. Vertex color sources are selectable; that is, you can configure the system to select the source for the vertex-color portions of lighting formulas at run time. The D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DRENDERSTATE_DIFFUSEMATERIALSOURCE, and D3DRENDERSTATE_SPECULARMATERIALSOURCE render states control the source from which the system draws the associated colors during lighting calculations. Each of these render states can be set to a member of the D3DMATERIALCOLORSOURCE enumerated type, which defines values that cause the system to use the current material, or a color from the vertex, as the color source.

[Visual Basic]

From Visual Basic, vertex colors are used by the system only when you set the D3DRENDERSTATE_COLORVERTEX render state to True. Vertex color sources are selectable; that is, you can configure the system to select the source for the vertex-color portions of lighting formulas at run time. The D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DRENDERSTATE_DIFFUSEMATERIALSOURCE, and D3DRENDERSTATE_SPECULARMATERIALSOURCE render states control the source from which the system draws the associated colors during lighting calculations. Each of these render states can be set to a member of the CONST_D3DMATERIALCOLORSOURCE enumeration, which defines values that cause the system to use the current material, or a color from the vertex, as the color source.