Direct3D uses the following formula to compute diffuse reflection factors:
In this formula, Rd is the diffuse reflectance factor, D is the direction that the light travels to the vertex, and N is the vertex normal. Vectors D and N are normalized vectors. The light's direction vector is reversed by multiplying it by -1 to create the proper association between the direction vector and the vertex normal. This formula produces values that range from -1.0 to 1.0, which are clamped to the range of 0.0 to 1.0 and used to scale the intensity of the light reflecting from the vertex.
After the diffuse reflection formula is applied, the light has been scaled appropriately for attenuation over distance, spotlight effects, and diffuse reflection. The scaled light is then applied to the diffuse reflectance property of the material that the vertex uses and ambient reflection is considered to determine the diffuse component at that vertex. The formula that combines ambient and diffuse reflection to create the diffuse component for the vertex looks like this:
In the preceding formula, Dv is the diffuse component being calculated for the vertex, Ia is the ambient light level in the scene, Ma is the material's ambient reflection property, and the Me variable is the emissive property for the material. The A variable is the attenuated light at the vertex (see Light Attenuation Over Distance) and Rd is the diffuse reflectance factor. The Cd variable can be one of two possible colors, the one used depends on the state of the system and the format of the vertex at the time. If the D3DLIGHTSTATE_COLORVERTEX light state is enabled (and diffuse color is present in the vertex), the system uses the diffuse vertex color in Cd. Otherwise, the system uses the diffuse material color for Cd. If a diffuse vertex color is present, the output alpha is equal to the diffuse alpha for the vertex. Otherwise, output alpha is equal to the alpha component of diffuse material, clamped to the range [0, 255].
After applying this formula, Dv is the diffuse color component for the vertex being lit.
For more information, see Specular Reflection Model, Spotlight Falloff Model.