1. Definition
Phong shading is a per-pixel shading technique used to simulate realistic lighting on surfaces.
- It calculates color at every pixel by interpolating surface normals across a polygon and then applying the Phong illumination model.
- Produces smooth highlights and realistic appearance compared to flat or Gouraud shading.
2. Phong Illumination Model
The Phong model combines three components of light:
I=Iambient+Idiffuse+Ispecular
Where:
A. Ambient Component
- Uniform background light, direction-independent.
Iambient=ka⋅Ia
- ka = ambient reflection coefficient, Ia = ambient light intensity.
B. Diffuse Component (Lambertian Reflection)
- Light scattered equally in all directions from a matte surface.
- Depends on the angle between surface normal N and light vector L:
Idiffuse=kd⋅Il⋅max(0,N⋅L)
- kd = diffuse coefficient, Il = light intensity.
C. Specular Component
- Light reflected in a specific direction from shiny surfaces.
- Depends on surface normal N, light vector L, view vector V, and shininess exponent n:
Ispecular=ks⋅Il⋅(max(0,R⋅V))n
- ks = specular reflection coefficient, R = reflection of L about N, V = view vector, n controls highlight sharpness.
3. Phong Shading Algorithm
- Compute vertex normals for each vertex of the polygon.
- Interpolate normals across the polygon for each pixel.
- Compute color per pixel using the Phong illumination model.
- Produces smooth shading with correctly placed specular highlights, unlike Gouraud shading which interpolates color.
4. Comparison with Other Shading Methods
| Shading Type |
How Normals Are Used |
Where Color Computed |
Result |
| Flat |
One normal per face |
One color per polygon |
Faceted, sharp edges |
| Gouraud |
Normals at vertices |
Interpolates vertex colors |
Smooth but may miss specular highlights |
| Phong |
Normals interpolated per pixel |
Color computed per pixel |
Smooth and realistic highlights |
5. Advantages of Phong Shading
- Produces realistic lighting and smooth highlights.
- Correctly models specular reflections.
- Works well for curved surfaces.
6. Disadvantages
- Computationally more expensive than flat or Gouraud shading.
- Requires interpolation of normals and per-pixel calculations.
Key Points:
- Phong shading = interpolated normals + Phong illumination.
- Essential for high-quality graphics in games, simulations, and CGI.
- Controls like shininess exponent n allow customizing surface glossiness.