Making DOOM 3 Mods : Lighting

The biggest technological advancement in the Doom 3 engine is the unified per-pixel lighting.

In previous engines, world geometry went through a different rendering and lighting path than model geometry (such as characters and objects). If an object moved, the lighting would always look wrong on it. Either the lighting would not move with the object, or there simply wouldn't be lighting and shadows for the object. It is very hard to create tension because you would get the effect seen in cartoons where you could pick out the brick that was going to move because it was always a different color.

In Doom 3, however, all triangles go through the same render backend. This means you can have an entity next to a piece of world geometry, and they will look exactly the same. You never know which panel the imp is going to pop out of, because all the wall panels integrate seemlessly into the world.

Every object has a material on it. This material defines how the lighting and shadow system will interact with the object (it also defines how the sound system interacts, but we won't get in to that).

Each triangle has three seperate images associated with it: the bump map, the diffuse map, and the specular map.

The bump map (or normal map) is a way to simulate geometry on a flat surface. Normally, when light hits a flat surface, it reflects at the exact angle of impact. When a surface has a normal map on it, the angle of reflection is perturbed some amount depending on the RGB value of the pixel the light hit.

Bump maps are explained in greater detail in the bumpmaps section.

A specular map is a gray scale image that defines how 'shiny' an object is. The more white a pixel is, the more it reflects light back in to the camera. Something like a dirt road would pretty much have a pure black specular map, but something like chrome would have almost a pure white specular map.

The diffuse map is what actually gives the object color. It should only be "local color" with no shadows or highlights because those will be added in later by the lighting system. The diffuse map should be created as if the object were being lit on all sides by pure white ambient light.

Copyright © 2004 id software