Friday, March 23, 2007

DirectX Fixed Function Lighting - Part 1

So I have been studying the lighting module included with DirectX (fixed-function pipeline) and I created this as a summary of these effects.

There are three main types of illumination models.

  1. Emissive - The object "emits" its own light (ie. neon sign)
  2. Ambient - A an object is lit by an outside source, based on the material properties of the object, it will reflect this light, which will subsequently be reflected by other objects, until eventually all objects are lit.
  3. Direct Lighting - This is further broken into two subcategories (positional and directional). Positional is where the light is coming from one defined point in space. Directional is where the light comes from a source that is infinately far away (ie. sun).

We can set emissive at the object level, on frame advance, and we can also set the ambient level at the device level. So we are really focusing on direct lighting. With direct lighting two other illumination types are introduced, diffuse light and specular light.

  1. Diffuse Light - the full intensity of the light, scaled by the cosine of the angle between the normals of the light source and the object face. Lambert's Law dictates this.
  2. Specular Light - used to highlight an object to give the illusion of shiny and smooth surface.

This leads to the basic lighting equation used by DirectX.

I = A + D + S + E

A = Ambient Light
D = Diffuse Light
S = Specular Light
E = Emissive Light

No comments: