Lecture 8 Object Modeling
Lecture 8 Object Modeling
specular final
Phong Lighting Model
Lighting or illumination refers to the technique that handles
the interaction between lights and objects.
The most popular lighting method is based on the Phong
model. It is widely adopted in commercial games and lays
foundations of various advanced lighting techniques.
The last term of the Phong model is the emissive term me that
describes the amount of light emitted by a surface itself.
Phong Lighting Model
The Phong model sums the four terms!!
Local Shading Models
• Local shading models provide a way to determine the
intensity and color of a point on a surface
• The models are local because they don’t consider other objects at
all
• We use them because they are fast and simple to compute
• They do not require knowledge of the entire scene, only the current
piece of surface
Local Shading Models
• What they capture:
• Direct illumination from light sources
• Diffuse and Specular components
• (Very) Approximate effects of global
lighting
• Advantages:
• Fast - one shading value per polygon
• Disadvantages:
• Inaccurate
• Discontinuities at polygon boundaries
Gourand Shading
• In 1971, Henri Gouraud suggested that
computing the lighting at the vertices and then
interpolating the color across the triangle
could simulate the appearance of smooth
surfaces
• Advantages:
• Fast - incremental calculations when rasterizing
• Much smoother - use one normal per shared vertex to
get continuity between faces
• Disadvantages:
• Specularities get lost
Phong Shading
• Computing lighting at the vertices is fast, but has several
limitations
• For high quality rendering, it is much more common to
compute lighting per pixel
• In order to render triangles as smooth surfaces, the most
common technique is to interpolate the normals across the
triangle and then use the interpolated normal (and position) to
compute the per-pixel lighting
• This is known as Phong shading or Phong interpolation
(not to be confused with the Phong lighting model)
• Modern graphics hardware can perform Phong shading
through the use of pixel shaders
Phong Interpolation
• Interpolate normals across faces
• Shade each pixel
• Advantages:
• High quality, narrow specularities
• Disadvantages:
• Expensive
• Still an approximation for most surfaces
Hidden Surface Removal
Visibility
• Assumption: All polygons are opaque
back-facing
Ideas?
front-facing
Depth Sorting
• Requirements
Draw polygons in back-to-
front order
Need to sort the polygons
by depth order to get a from Shirley
correct image
Painter’s Algorithm
• Render polygons in back to front order so that
polygons behind others are simply painted over
38
Painter’s Algorithm - Hard Cases
No solution for:
• Cyclic ordering
• Intersecting surfaces
penetration
cyclic overlap
39