Mathematics of Lighting
The Light Model covers ambient, diffuse, specular, and emissive lighting. This is enough flexibility to solve a wide range of lighting situations. You refer to the total amount of light in a scene as the global illumination and compute it using the following equation.
Global Illumination = Ambient Light + Diffuse Light + Specular Light + Emissive Light
Ambient lighting is constant lighting. It is constant in all directions and it colors all pixels of an object the same. It is fast to calculate but leaves objects looking flat and unrealistic.
Diffuse lighting depends on both the light direction and the object surface normal. It varies across the surface of an object as a result of the changing light direction and the changing surface numeral vector. It takes longer to calculate diffuse lighting because it changes for each object vertex, however the benefit of using it is that it shades objects and gives them three-dimensional (3-D) depth.
Specular lighting identifies the bright specular highlights that occur when light hits an object surface and reflects back toward the camera. It is more intense than diffuse light and falls off more rapidly across the object surface. It takes longer to calculate specular lighting than diffuse lighting, however the benefit of using it is that it adds significant detail to a surface.
Emissive lighting is light that is emitted by an object, for example, a glow.
Attenuation controls how a light's intensity decreases toward the maximum distance specified by the range property. Awakening applies the following formula to calculate light attenuation over distance for point lights and spotlights ( directional lights don't attenuate ).
In this attenuation formula, A is the calculated total attenuation and D is the distance from the light source to the sample point. Attenuation0, Attenuation1, and Attenuation2 values are the light's attenuation constants.