Dec 13 '15
Authors:
This is an older version of the article. Click here to see the current one.

Lights

A light is a source of light which bounces around a scene of objects and ultimately enters the camera to form a 2D image. Lights have colour and brightness and are often categorized into directional, point, spot, area and volume lights. A material can also be a light source if given an emissive property. Having geometry with emissive properties in the scene matches reality better as light is emitted from matter, however supporting such generalized light sources can be expensive especially for rasterizers, especially when supporting shadows.

Directional lights are lights with infinitely far position and no attenuation, or reduction of intensity, over distance. For example, the sun is so far away that relative changes in position are insignificant. Because of this approximation, a globally constant light direction vector can be used in the lighting calculations. In the first real-time graphics applications, small optimizations such as this was important, particularly for Blinn-Phong specular highlights where both an infinite viewer and infinite light allow a constant half-vector.

Point lights have a world space position and a light direction vector is calculated at every shaded point. An attenuation is often applied to point lights, not because of any for or absorption effects, but because the light is “spread thin” as it moves outwards from a point. Think of a sphere growing in size, being the wavefront of traveling light. As it grows, the same amount of light on its surface must cover a greater area. This area increases with the square of the distance, $d^2$. Likewise the intensity is scaled down by $\frac{1}{d^2}$.

A spot light is really just a point light with a cover so that light only goes in one direction, which although more expensive could be modeled with geometry and shadows. A direction vector and angle for the width of the beam are its attributes. Rather than a sharp cutoff for points outside the angle, a ramp is often used to simulate soft shadows at the spotlight edges.

Area lights are an extension of point lights, forming a flat surface. They are much more expensive and produce soft shadows. A common area light is a disc to model the silhouette of a sphere such as the sun or light bulb. Rather than a single point, the light from them is the integral over the lights area. They could be approximated as a collection of point lights distributed over the area. A raytracer essentially does this, numerically integrating the light by tracing rays to many points over the area. An emissive material applied to a triangle mesh of a light bulb could be considered many area lights, one for each triangle.

A volume light is the same thing, but with light coming from everywhere within a volume. An example may be the flame of a candle, where the gas is so hot it emits light.

To support arbitrary materials emitting light, a raytracer can employ multiple importance sampling, where rays are generated at higher frequency in the direction of known emissive surfaces, avoiding samples which do not affect the result.

Multiple lights can be added to the scene by simply adding the colour from each. For rasterization, this can become very expensive quickly as many vertices and fragments are processed which are not seen or are unaffected by most lights. Deferred shading is a technique which computes the sum of many lights on the image, after all the geometry has been rendered. It avoids computation for hidden surfaces and scales well when lights are small and only affect their immediate surroundings.