9 Illumination And Shading Models

Computer Graphics · Unit 9

Illumination and Shading Models

Exam-focused notes for Illumination and Shading Models (Computer Graphics, BIT304): what the TU syllabus asks and how it has actually been tested, with 10 solved past questions from this unit.

Illumination and Shading Models in short

Lighting and shading make a flat-looking 3D object look solid and real. An illumination model finds the brightness at a point, and a shading method spreads it over a whole polygon.

Illumination and Shading Models: notes

Ambient light and ambient reflection

Ambient light is the general, non-directional light that fills the scene after bouncing around many times. It comes from everywhere and lights all surfaces equally. Without it, surfaces facing away from a light would be pure black.

Ambient reflection is the part of ambient light that a surface sends back. The intensity is:

$$I_{amb} = k_a , I_a$$

where $I_a$ is the ambient light intensity and $k_a$ ($0 \le k_a \le 1$) is the ambient reflection coefficient of the surface.

Example: $I_a = 0.4$ and $k_a = 0.5$ give $I_{amb} = 0.2$.

Effect on the scene:

  • Gives a base brightness to every surface, regardless of direction.
  • Stops shadowed parts from becoming completely black.
  • Does not show shape, because every point gets the same value. Alone, it makes objects look flat.
  • A higher $I_a$ makes the whole scene look brighter and less contrasty.

Diffuse reflection

Diffuse reflection happens on rough, dull surfaces such as chalk or paper. Light is scattered equally in all directions, so the surface looks equally bright from any viewing angle. Brightness depends on the angle between the surface normal $N$ and the direction to the light $L$. This is Lambert's cosine law:

$$I_{diff} = k_d , I_l \cos\theta = k_d , I_l ,(N \cdot L)$$

Here $\theta$ is the angle between $N$ and $L$ (unit vectors), $k_d$ is the diffuse coefficient and $I_l$ the light intensity. If $\theta > 90^\circ$ the surface faces away and $I_{diff} = 0$.

Example: $I_l = 1$, $k_d = 0.6$, $\theta = 60^\circ$ give $I_{diff} = 1 \times 0.6 \times 0.5 = 0.3$.

Difference between ambient light and diffuse reflection:

PointAmbientDiffuse
SourceSurrounding light from all sidesA particular light source
DirectionNoneDepends on the angle to the light
Depends on normalNoYes ($N \cdot L$)
Formula$k_a I_a$$k_d I_l (N \cdot L)$
EffectSame brightness everywhereGives the shape and depth

Specular reflection

Specular reflection is the mirror-like reflection on shiny surfaces such as metal or a polished apple. It produces a bright spot called the highlight. It depends on the viewer position and is strongest when the viewer is close to the direction of the reflected ray $R$.

Let $V$ be the direction to the viewer and $\alpha$ the angle between $R$ and $V$. The Phong specular term is

$$I_{spec} = k_s , I_l \cos^{n}\alpha = k_s , I_l ,(R \cdot V)^{n}$$

where $k_s$ is the specular coefficient and $n$ the shininess exponent. A large $n$ (100 or more) gives a small, sharp highlight, like a mirror. A small $n$ (a few) gives a wide, soft highlight. The reflected vector is $R = 2(N \cdot L)N - L$.

Example: $I_l = 1$, $k_s = 0.5$, $\cos\alpha = 0.9$, $n = 10$: $0.9^{10} = 0.349$, so $I_{spec} = 0.5 \times 0.349 = 0.174$.

What this unit covers

  • Ambient light and ambient reflection
  • Diffuse reflection
  • Specular reflection
  • Phong illumination model
  • Phong shading algorithm and procedure
  • Gouraud shading model and derivations
  • Flat shading and disadvantages
  • Intensity attenuation

Ambient light and ambient reflection

2082 · 5 marks

Explain the concept of ambient reflection in the context of illumination models. How does it affect the overall lighting in a 3D scene? [5]

Ambient reflection is the component of light reflection that accounts for indirect, non-directional illumination in a 3D scene. It represents light that has been scattered and reflected multiple times throughout the environment, coming from all directions uniformly. Non-directional nature: Unlike...

Open this answer on its own page →

2081 · 5 marks

Write short notes on: a) Ambient light b) Diffuse reflection [5]

Show solved answer

Short Notes: Ambient Light and Diffuse Reflection

a) Ambient Light

Definition: Ambient light is the general, non-directional illumination present in a scene that comes from all directions uniformly. It represents indirect light that has been scattered and reflected multiple times throughout the environment.

Characteristics:

  • Has no specific source or direction
  • Provides uniform illumination to all surfaces regardless of their orientation
  • Prevents completely dark areas in a scene (shadows are not pitch black)
  • Typically modeled as a constant intensity value in rendering equations

Role in Rendering: In computer graphics, ambient light is often included in the illumination model to ensure all surfaces receive some minimum level of brightness. Without ambient light, surfaces facing away from light sources would appear completely black, which is unrealistic.

Formula representation: I_ambient = K_a × I_a

where K_a is the ambient reflection coefficient and I_a is the ambient light intensity.


b) Diffuse Reflection

Definition: Diffuse reflection occurs when light strikes a rough or matte surface and is scattered uniformly in all directions. The reflected light intensity depends on the angle between the surface normal and the incident light direction.

Characteristics:

  • Occurs on rough, non-shiny surfaces (paper, cloth, matte paint)
  • Follows Lambert's Cosine Law: reflected intensity is proportional to the cosine of the angle between the surface normal and light direction
  • Independent of viewer position (appears same from all viewing angles)
  • Produces no specular highlights

Lambert's Law: I_diffuse = K_d × I_light × cos(θ)

where:

  • K_d = diffuse reflection coefficient (0 to 1)
  • I_light = incident light intensity
  • θ = angle between surface normal and light direction

Physical Basis: The cosine relationship arises because light energy is distributed over a larger surface area as the angle increases, reducing intensity per unit area.

Open this answer on its own page →

2080 · 5 marks

Explain ambient light, diffuse reflection and specular reflection with examples. [5]

Definition: Ambient light is the general, non-directional illumination present in a scene that comes from all directions uniformly. It represents light that has been scattered and reflected so many times in an environment that its original direction is no longer identifiable. Characteristics: - H...

Open this answer on its own page →

Gouraud shading model and derivations

2082 · 5 marks

Describe the Gouraud Shading model. How does Gouraud shading improve the rendering of 3D objects compared to constant shading? [5]

Gouraud shading is an interpolation-based shading technique that computes color values at polygon vertices and then linearly interpolates these colors across the surface of each polygon during rasterization. It provides a smooth appearance by avoiding the faceted look of constant shading. The pro...

Open this answer on its own page →

Phong shading algorithm and procedure

2081 · 5 marks

Write procedure to render the polygon surface by using Phong shading model. [5]

Phong shading is an interpolation-based shading technique that calculates surface color at each pixel by interpolating normal vectors across the polygon surface and applying the Phong illumination model at each point. - Compute the surface normal at each vertex of the polygon - For a polygon with...

Open this answer on its own page →

2079 · 5 marks

Differentiate Phong Shading with Gouraud Shading method. [5]

Aspect Gouraud Shading Phong Shading ---------------------------------------- Normal Calculation Normals computed at vertices only Normals computed at each pixel/fragment Intensity Calculation Intensity calculated at vertices, then interpolated across polygon Intensity calculated at each pixel af...

Open this answer on its own page →

0 · 10 marks

Differentiate Between Ambient Light and Diffuse Reflection. Write Algorithm for Phong Shading. [10]

Show solved answer

Model Answer: Ambient Light vs Diffuse Reflection & Phong Shading Algorithm

Part A: Differentiation Between Ambient Light and Diffuse Reflection

AspectAmbient LightDiffuse Reflection
DefinitionConstant background illumination that uniformly lights all surfaces regardless of position or orientationLight reflected equally in all directions from a surface based on the angle of incoming light
Direction DependencyIndependent of light source direction and viewer positionDepends on the angle between light source direction and surface normal
FormulaI_ambient = K_a · I_aI_diffuse = K_d · I_l · cos θ = K_d · I_l · (N̂ · L̂)
Surface NormalNot required for computationRequired to calculate the angle of incidence
AppearanceFlat, uniform illumination with no shading variationShading varies across surface based on orientation
RealismLow: no depth perceptionModerate: gives sense of 3D shape
Light SourceSimulates indirect/scattered light in environmentSimulates direct light hitting a rough/matte surface
Shadow EffectNo shadows producedSurfaces facing away from light appear darker
ExampleAmbient light in a room with no visible sourceChalk piece or matte wall under a bulb

Part B: Algorithm for Phong Shading

Phong Shading is a per-pixel shading method where surface normals are interpolated across the polygon and the illumination model is applied at each pixel to produce smooth, realistic highlights.

Algorithm Steps:

Step 1: For each polygon, compute normal vectors at each vertex (N̂₁, N̂₂, N̂₃) using the average of normals of adjacent polygons.

Step 2: For each scan line that intersects the polygon, determine the boundary edges (left and right intersection points).

Step 3: Interpolate normals along polygon edges. For each edge, linearly interpolate vertex normals to get the normal at each edge intersection point on the scan line:

$$\hat{N}_a = \frac{y - y_2}{y_1 - y_2}\hat{N}_1 + \frac{y_1 - y}{y_1 - y_2}\hat{N}_2$$

Step 4: Interpolate normals along the scan line. For each pixel between left and right edge, interpolate the normal:

$$\hat{N}p = \frac{x{right} - x}{x_{right} - x_{left}}\hat{N}a + \frac{x - x{left}}{x_{right} - x_{left}}\hat{N}_b$$

Step 5: Normalize the interpolated normal at each pixel:

$$\hat{N}_p = \frac{\hat{N}_p}{|\hat{N}_p|}$$

Step 6: Apply the Phong illumination model at each pixel using the interpolated normal:

$$I = K_a I_a + K_d I_l (\hat{N}_p \cdot \hat{L}) + K_s I_l (\hat{R} \cdot \hat{V})^n$$

Where:

  • K_a, K_d, K_s = ambient, diffuse, specular reflection coefficients
  • I_a = ambient light intensity
  • I_l = light source intensity
  • R̂ = reflection vector
  • V̂ = viewer direction vector
  • n = shininess exponent

Step 7: Assign the computed intensity value to the pixel.

Step 8: Repeat for all scan lines until the entire polygon is rendered.

Advantages:

  • Produces realistic specular highlights that appear smooth and correctly positioned
  • Eliminates Mach band effect seen in Gouraud shading
  • Gives high-quality rendering for curved surfaces

Disadvantage:

  • Computationally expensive since illumination model is evaluated at every pixel
Open this answer on its own page →

Intensity attenuation

2081 · 5 marks

What is intensity attenuation? Describe the various types of projection. [5]

Intensity attenuation refers to the reduction or weakening of light intensity as it travels through a medium or interacts with surfaces. In computer graphics and rendering contexts, this occurs due to: - Distance effects: Light intensity decreases with distance from the source (inverse square law...

Open this answer on its own page →

Phong illumination model

2079 · 5 marks

Explain the Phong illumination model for specular reflection. [5]

The Phong illumination model is a widely-used empirical model in computer graphics that calculates the intensity of light reflected from a surface by combining three components: ambient, diffuse, and specular reflection. For specular reflection specifically, it models how shiny surfaces reflect l...

Open this answer on its own page →

Flat shading and disadvantages

0 · 5 marks

What are the disadvantages of flat shading? How they can be eliminated? [5]

  1. Faceted Appearance - Flat shading produces a visually faceted or polygonal appearance on curved surfaces - Each polygon is rendered with a single uniform color, making individual faces clearly visible - This creates an unrealistic, blocky look that does not represent smooth surfaces naturally ...
Open this answer on its own page →