Lighting
A version of this page is also available for
4/8/2010
Microsoft® Direct3D® Mobile simulates lighting effects on a per vertex basis. When lighting is enabled, lighting parameters are used to compute a diffuse and possibly a specular color value for each vertex. These color values are passed to the rasterizer, which then interpolates them per pixel across a primitive.
You can enable lighting by using the D3DMRS_LIGHTING render state (see D3DMRENDERSTATETYPE). If the value of this render state is TRUE, lighting is enabled and the per-vertex colors are generated according to lighting computations. If the value of this render state is FALSE, then lighting is disabled and no calculations are made. The default value for this render state is TRUE.
The D3DMDEVCAPS_SPECULAR capability bit describes whether a device supports specular lighting. If your device supports specular lighting You can further refine the lighting operations by using the D3DMRS_SPECULARENABLE render state. If the value of this render state is TRUE, specular computations are enabled per vertex. If the value of this render state is FALSE, only the diffuse color is computed, and the specular color for all vertices is set to 0.
The lighting computation depends on several render states, but also on the current material and the current lights enabled in the scene.
The following topics provide additional information about lighting.