Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

3.6 Illumination Model - Ambient, Diffuse, Specular

Lesson 24 of 32 in the free Computer Graphics notes on Siksha Sarovar, written by Rohit Jangra.

What Is Illumination

An illumination model computes the color of a point on a surface based on light sources, the surface material, and the viewing direction. The classical model, Phong illumination (Bui Tuong Phong, 1973), sums three terms.

Phong Illumination Equation

I = k_a I_a + sum over lights of f_att (k_d (L . N) I_l + k_s (R . V)^n_s I_l)

Where:

  • I_a = ambient light intensity, I_l = light l intensity.
  • k_a, k_d, k_s = ambient, diffuse, specular reflection coefficients (per RGB channel).
  • N = surface normal (unit), L = unit vector to light, V = unit vector to viewer, R = reflection of L about N.
  • n_s = specular exponent ("shininess"), small n_s = broad highlight, large n_s = tight highlight.
  • f_att = distance attenuation, often 1 / (a + bd + cd^2) with d = distance to light.

1. Ambient

Constant background light approximating indirect illumination. Without it, surfaces facing away from all lights would be pitch black, which is unrealistic.

2. Diffuse (Lambertian)

Incoming light scatters uniformly in all directions. Intensity proportional to cos(angle between N and L) = max(0, N . L). The same point looks equally bright from every viewing direction.

3. Specular

Light reflects mostly along R = 2(N.L) N - L. If V is close to R, you see a bright highlight. Power n_s controls how shiny the surface looks - 5 for plastic, 200 for polished metal.

Distance Attenuation

  • Real photons fall off as 1/d^2.
  • In CG we often add a constant a and linear b to avoid singularities and to artistically tune.
  • Strong attenuation -> dramatic local lighting; weak attenuation -> flat fill.

Worked Mini-Example

Single point light, white I_l = 1, k_d = 0.7, k_s = 0.4, k_a = 0.1, n_s = 64. At point P, N=(0,1,0), L=(0,1,0), V=(0,1,0).

  • N.L = 1 -> diffuse = 0.7.
  • R = (0,1,0). R.V = 1 -> specular = 0.4 * 1^64 = 0.4.
  • Ambient = 0.1.
  • Total = 0.1 + 0.7 + 0.4 = 1.2 -> clamp to 1.0 (HDR systems keep >1 for tone mapping).

Material Color

Each k_x is a 3-vector (k_x_R, k_x_G, k_x_B) so different colored lights and materials interact naturally. A red ball under green light has very low diffuse contribution (red diffuse coefficient * green light = ~0).

Limitations and Beyond

  • Ignores energy conservation (k_d + k_s can exceed 1).
  • Ignores Fresnel (reflection grows at glancing angles).
  • Ignores microfacet roughness statistics.
  • Modern PBR (Physically-Based Rendering) replaces Phong with Cook-Torrance or GGX microfacet models that include Fresnel, geometry shadowing, and energy conservation.
  • Phong remains fundamental as a teaching baseline and is exact enough for many real-time effects.