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.
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]
2081 · 5 marks
Write short notes on: a) Ambient light b) Diffuse reflection [5]
Show solved answerHide 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.
2080 · 5 marks
Explain ambient light, diffuse reflection and specular reflection with examples. [5]
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]
Phong shading algorithm and procedure
2081 · 5 marks
Write procedure to render the polygon surface by using Phong shading model. [5]
2079 · 5 marks
Differentiate Phong Shading with Gouraud Shading method. [5]
0 · 10 marks
Differentiate Between Ambient Light and Diffuse Reflection. Write Algorithm for Phong Shading. [10]
Show solved answerHide answer
Model Answer: Ambient Light vs Diffuse Reflection & Phong Shading Algorithm
Part A: Differentiation Between Ambient Light and Diffuse Reflection
| Aspect | Ambient Light | Diffuse Reflection |
|---|---|---|
| Definition | Constant background illumination that uniformly lights all surfaces regardless of position or orientation | Light reflected equally in all directions from a surface based on the angle of incoming light |
| Direction Dependency | Independent of light source direction and viewer position | Depends on the angle between light source direction and surface normal |
| Formula | I_ambient = K_a · I_a | I_diffuse = K_d · I_l · cos θ = K_d · I_l · (N̂ · L̂) |
| Surface Normal | Not required for computation | Required to calculate the angle of incidence |
| Appearance | Flat, uniform illumination with no shading variation | Shading varies across surface based on orientation |
| Realism | Low: no depth perception | Moderate: gives sense of 3D shape |
| Light Source | Simulates indirect/scattered light in environment | Simulates direct light hitting a rough/matte surface |
| Shadow Effect | No shadows produced | Surfaces facing away from light appear darker |
| Example | Ambient light in a room with no visible source | Chalk 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
Intensity attenuation
2081 · 5 marks
What is intensity attenuation? Describe the various types of projection. [5]
Phong illumination model
2079 · 5 marks
Explain the Phong illumination model for specular reflection. [5]
Flat shading and disadvantages
0 · 5 marks
What are the disadvantages of flat shading? How they can be eliminated? [5]
Make Unit 9 stick
Practice BIT304 with flashcards & quizzes