Illumination & Shading

1. Physics of Light

The color & shading intensity of a point on an object depends on the characteristics of the object (i.e. position, surface normal, albedo) and the light sources (i.e. intensity, distance) that illuminate it.

Albedo is an object's ability to absorb light energy, or reflectivity.

  • Energy of a photon .
  • Radiant energy of photons .
  • Radiation flux (power) .
  • Radiance is the radiant flux per unit solid angle per unit projected area, measured in . It represents the number of photons per time at a small area in a particular direction. It is given by , where is the angle between the surface normal and the direction of the incoming light.
  • Irradiance is the differential flux onto a differential are, measured in . It is given by . It is the density of incident flux falling onto a surface.

2. Reflection & Reflectance

Reflection is the process by which electromagnetic flux incident on a surface leaves the surface without a change in frequency.

Reflectance is the fraction of incident flux that is reflected by a surface.

Reflectance is given by a bidirectional reflectance distribution function (BRDF), which is defined as . It is the ratio of reflected radiance in a given direction to the incident irradiance from a given direction. It is a function of the incoming and outgoing angles, and has units of .


Isotropic BRDFs are simplified models that assume the reflectance is the same in all directions, i.e. . This reduces the number of parameters from 4 to 3, and is a common assumption in computer graphics.


Anisotropic BRDFs are more complex models that account for directional dependence of reflectance, such as brushed metal or hair. They require more parameters to describe the reflectance behavior.

BRDFs may have the following properties:

A more precise model for reflection is the bidirectional scattering surface reflectance distribution function (BSSRDF), which includes both reflection and transmission.

2.1 Computing Reflected Radiance

To compute the reflected radius, we say:

Or, in the discrete case, for point light sources:

Where is the direction of the incoming light, is the angle between the surface normal and the incoming light, is the radiant flux of the -th light source, and is the distance from the surface point to the -th light source.

2.2 Ideal Diffuse Reflectance

Here, assume the surface reflects equally in all directions. In reality, this is a very rough surface (e.g. chalk, clay, dull paints). Here, the BRDF value is constant, so:

Ideal diffuse reflectors reflect light according to Lambert's Cosine Law, which states that the intensity of reflected light is proportional to the cosine of the angle between the surface normal and the incoming light.

For IDR, given the diffuse reflection coefficient , the surface normal and the light direction , the reflected radiance is given by:

Here, the dot product is clamped to avoid negative values, which would correspond to light coming from behind the surface. The term accounts for the attenuation of light with distance, following the inverse square law.

2.3 Ideal Specular Reflectance

Here, reflection is only at a mirror angle. This is view dependent, and is a very smooth surface (e.g. polished metal). Real-world materials are usually not perfect reflectors.

2.4 Non-ideal Reflectors

We expect most of the reflected light to be reflected in the direction of the ideal ray. Because of microscopic surface variations we might expect some light to be reflected at a slight offset to the ideal reflected ray. As we move farther away (in the angular sense) from the reflected ray we expect to see less light reflected.

3. Phong Model

The Phong model is a mathematical model deciding how much light is reflected.

Then:

3.1 Blinn-Phong Model

This model uses the halfway vector instead of the ideal reflected ray. When is the angle between and , the specular term is then given by:

3.2 Ambient Illumination

Ambient illumination is a hack to represent the reflection of all indirect illumination, avoiding the complexity of global illumination:

Adding it all together gives the Phong illumation model:

3.3 Heuristic Inverse Square

The term is responsible to make sure light falls off according to an inverse square law. Although physically correct, it can be visually unappealing. A common heuristic is to replace it with , where is a heuristic constant.

4. Shading

There are three levels of shading which can be applied to polygon based systems. These are responsible for determining the color of each pixel on the screen.

4.1 Flat Shading

Here, each polygon is shaded uniformly over its surface. This is computed by taking a point in the centre and the surface normal vector. Only diffuse and ambient components are used.

4.2 Gouraud Shading

Also known as interpolation shading. This is done by:

  1. Computing a shade value at each vertex.
  2. Interpolate to find the shade value at the boundary.
  3. Interpolate to find the shade value at each pixel.

In addition to interpolating shades over polygons, we can interpolate over groups of polygons to give an impression of a smooth surface.

4.3 Phong Shading

Also known as smooth shading, this is more accurate than Gouraud shading but slower. This interpolates normals across triangles, and computes the shade value at each pixel.

This interpolation is known as barycentric interpolation. Any point on a triangle can be represented in terms of its three vertices:

The average normal vector at that point is then given by:

These formulae come from barycentric coordinates where:

In other words, , where , , and are the barycentric coordinates of with respect to the triangle defined by , , and .

The interpolation calculates may be done in either or 2D or 3D. For specular reflection, it must be done in 3D.

Back to Home