Phong Illumination Model And Shading Computer Graphics

Study guide

Phong Illumination Model and Phong Shading: Formula and Shading Methods Compared

Illumination model in computer graphics for CSC214 unit 8 and BIT304 unit 9: the Phong lighting model formula, coefficients, shininess exponent, attenuation, and flat vs Gouraud vs Phong shading in a table.

2026-10-24 | notesharu team

"Explain the Phong illumination model" and "compare flat, Gouraud and Phong shading" appear together so often that they are best revised as one topic. They belong to TU BSc CSIT Computer Graphics (CSC214), unit 8 "Illumination Models and Surface Rendering Techniques", and to BIT Computer Graphics (BIT304), unit 9 "Illumination and Shading Models".

This guide explains what an illumination model in computer graphics is, builds the Phong lighting model term by term (ambient, diffuse, specular) with the formula, explains the coefficients and the shininess exponent, adds attenuation, and then compares the three surface rendering methods: flat shading, Gouraud shading and Phong shading. The unit notes are on the CSC214 Illumination Models and Surface Rendering page and the BIT304 Illumination and Shading Models page.

Illumination model versus shading model

An illumination model (also called a lighting or reflection model) is a formula that gives the intensity of light seen at one point on a surface, given the light sources, the surface properties and the viewer position. A shading (surface rendering) model decides where the illumination model is applied: at every pixel, at polygon vertices only, or once per polygon. So the illumination model answers "how bright is this point" and the shading method answers "for which points do we calculate it, and how do we fill the rest".

Components of the Phong illumination model

The Phong model is an empirical model for a point light source. It adds three components of reflected light.

Ambient light

Ambient light is the uniform background light that reaches every surface after scattering around the scene. It does not depend on direction. With ambient intensity $I_a$ and ambient reflection coefficient $k_a$, the contribution is $k_a I_a$. Without this term, surfaces facing away from the light would be completely black.

Diffuse reflection (Lambert's cosine law)

A rough, matte surface scatters light equally in all directions, so its brightness does not depend on where the viewer stands, only on the angle between the surface normal $\mathbf{N}$ and the direction to the light $\mathbf{L}$. Lambert's cosine law says the intensity is proportional to $\cos\theta = \mathbf{N}\cdot\mathbf{L}$, where $\theta$ is the angle of incidence. The surface is brightest when the light is along the normal and receives nothing when the light is at $90^\circ$ or behind.

Specular reflection

A shiny surface reflects light mostly in the mirror direction $\mathbf{R}$, producing the bright highlight. Phong approximated the falloff of the highlight away from $\mathbf{R}$ by $\cos^{n}\alpha$, where $\alpha$ is the angle between the reflection vector $\mathbf{R}$ and the viewing vector $\mathbf{V}$, and $n$ is the specular (shininess) exponent. The reflection vector is

$$\mathbf{R} = 2(\mathbf{N}\cdot\mathbf{L})\mathbf{N} - \mathbf{L}$$

The Phong formula

Adding the three terms for one light source gives

$$I = k_a I_a + k_d I_l (\mathbf{N}\cdot\mathbf{L}) + k_s I_l (\mathbf{R}\cdot\mathbf{V})^{n}$$

where $I$ is the final intensity at the point, $I_l$ is the intensity of the light source, and the dot products are taken as zero if negative. For several light sources the diffuse and specular terms are summed over all sources. For coloured surfaces the equation is applied separately to the red, green and blue components.

SymbolMeaning
$I_a$, $I_l$Intensity of ambient light and of the point light source
$k_a$Ambient reflection coefficient of the surface, between 0 and 1
$k_d$Diffuse reflection coefficient, the fraction of light scattered evenly
$k_s$Specular reflection coefficient, the strength of the highlight
$\mathbf{N}$Unit surface normal
$\mathbf{L}$Unit vector from the point towards the light
$\mathbf{R}$Unit mirror reflection vector of $\mathbf{L}$ about $\mathbf{N}$
$\mathbf{V}$Unit vector from the point towards the viewer
$n$Shininess exponent, controls highlight size

Effect of the shininess exponent

A large $n$ (100 or more) makes $\cos^n\alpha$ fall to near zero quickly, giving a small sharp highlight typical of metal or glass. A small $n$ (1 to 10) gives a wide soft highlight typical of plastic or paper. A perfect mirror would correspond to $n \to \infty$, where light is seen only exactly along $\mathbf{R}$.

Attenuation

Real light weakens with distance. To include this, the light intensity is multiplied by an attenuation factor that decreases with the distance $d$ from the source:

$$f(d) = \min\left(1, ; \frac{1}{a_0 + a_1 d + a_2 d^2}\right)$$

where $a_0$, $a_1$ and $a_2$ are constants chosen for the effect wanted. The diffuse and specular terms are scaled by $f(d)$, while the ambient term is not, because ambient light has no single source.

Surface rendering: flat, Gouraud and Phong shading

Evaluating the full Phong formula for every pixel is expensive, so polygon meshes are usually rendered by one of three methods.

Flat (constant) shading evaluates the illumination model once per polygon, using one normal and one point, and gives the whole polygon one intensity. It is fast but the polygon edges are visible, and the Mach band effect exaggerates the brightness steps between neighbouring faces.

Gouraud shading calculates the vertex normals by averaging the normals of all polygons that share the vertex, evaluates the illumination model at each vertex only, and then interpolates the intensity linearly along the edges and then across each scan line. The surface looks smooth and the cost is moderate, but a highlight that falls inside a polygon, away from the vertices, can be missed or smeared, and Mach bands may still appear.

Phong shading (the interpolation method, not to be confused with the Phong illumination model) interpolates the normal vectors instead of the intensities. The vertex normals are interpolated along edges and across scan lines, and the illumination model is evaluated at every pixel with the interpolated normal. Highlights are rendered accurately and Mach bands are greatly reduced, but the cost is the highest.

Comparison table

PointFlat shadingGouraud shadingPhong shading
What is evaluatedIllumination once per polygonIllumination at vertices onlyIllumination at every pixel
What is interpolatedNothingIntensity valuesNormal vectors
AppearanceFaceted, edges visibleSmooth, may lose highlightsSmooth, accurate highlights
Specular highlightsPoorOften missed inside a polygonHandled well
Mach bandsStrongReduced but presentGreatly reduced
ComputationLowestModerateHighest
Typical useQuick previewsReal-time rendering of smooth surfacesHigh quality rendering

Exam answer outline

For the 5-mark question "Explain the Phong illumination model", define an illumination model, write the three components with one line each, give the formula $I = k_a I_a + k_d I_l(\mathbf{N}\cdot\mathbf{L}) + k_s I_l(\mathbf{R}\cdot\mathbf{V})^n$, and define every symbol, mentioning the role of $n$. For "Differentiate between Gouraud and Phong shading", state what each interpolates, where the illumination model is evaluated, then the table rows on highlights, accuracy and cost. For a 10-mark question, combine both, add attenuation and a sentence on flat shading.

Visibility and hidden surface methods that come before shading are in the CSC214 Visible Surface Detections notes. The full subject pages are CSC214 Computer Graphics and BIT304 Computer Graphics.

Put it into practice

Browse all subjects