CS488 - Introduction to Computer Graphics - Lecture 20

Comments and Questions


Review

  1. Body reflection
  2. Surface reflection

Shading

Terminology

  1. Artist: shading
  2. Psychologist: shading
  3. Utah-graphics: shading
  4. Renderman: shader
  5. GPU: shaders

Meta-terminology

  1. What an umbrella does to a person from the rain or the sun

We are doing Utah-graphics


Flat Shading

Shade entire polygon one colour


Gouraud Shading

Calculate at vertices and interpolate linearly

Interpolating within triangles

  1. Barycentric coordinates
  2. For practical interpolation we care about P -> P + v
  3. C(P) = a1 * C(V1) + ...
  4. The calculations are affine-invariant, so you could

    BUT, the calculations are NOT projection-invariant

Interpolating within arbitrary polygons is a bad idea


Phong Shading

Interpolate the vertex normals, light vectors, and view vectors

Highlights are more precise


Ray Tracing

The idea is simple:

for each pixel
  calculate the eye/pixel ray
  project the ray into the scene
  find the first intersection
  apply illumination and shading calculations
  colour the pixel with the result

Eye-pixel ray

E + t*(P - E)

Object in scene

Set of points {Q} satisfying

Solve the equation

The surface might be defined by an algorithm, then use a root-finding method

Object is planar, e.g. a triangle

Equation of the plane is \sum_i ai*xi = b


Return to: