The Direct3D Light Model vs. Nature

In nature, when light is emitted from a source, it reflects off hundreds (if not thousands or millions) of objects before reaching the viewer's eye. Each time it reflects, parts of the light are absorbed by a surface, parts are scattered in random directions, and the rest goes on to another surface or to the viewer. This process continues until the light attenuates to nothing or a viewer perceives the light—but, who knows how many times the light will bounce? It could be once, a hundred times, or millions of times.

Obviously, the calculations required to perfectly simulate the natural behavior of light are, by far, too time consuming to be used for real-time 3-D graphics. Therefore, with the interest of speed in mind, the Direct3D light model approximates the way light works in the natural world. Direct3D describes light in terms of red, green, and blue components that combine to create a final color. For more information, see Color Values for Lights and Materials. In Direct3D, when light reflects off a surface, the light color interacts mathematically with the surface itself to create the color eventually drawn to the screen. For specific information about the algorithms Direct3D uses, see The Mathematics of Direct3D Lighting.

The Direct3D Immediate Mode light model generalizes light into two types: ambient light and direct light. Each has different attributes, and each interacts with the material of a surface in different ways. Ambient light is light that has been scattered so much that its direction and source are indeterminate: it maintains a low-level of intensity everywhere. The indirect lighting used by photographers is a good example of ambient light. Ambient light in Direct3D, as in nature, has no real direction or source, only a color and intensity. In fact, the ambient light level is completely independent of any objects in a scene that generate light. Ambient light does not contribute to specular reflection.

Direct light is the light generated by an object in a scene; it always has color and intensity, and travels in a specified direction. Direct light interacts with the material of a surface to create specular highlights, and its direction is used as a factor in shading algorithms, including Gouraud shading. When direct light is reflected, it does not contribute to the ambient light level in a scene. The objects in a scene that generate direct light (referred to as "lights" or "light objects") have different characteristics that affect how they illuminate a scene. For more information, see Lights.

Additionally, a polygon's material has properties that affect how that polygon reflects the light it receives. You set a single reflectance trait that describes how the material reflects ambient light, and you set individual traits to determine the material's specular and diffuse reflectance. For more information, see Materials.