12 - Color Shading

ucla | CS 174A | 2024-03-19 01:22


Table of Contents

Flat Shading

  • apply same color across a tesselated polygonal surface of an object
  • i.e., N is constant across the polygon/face
  • if L far enough, NL is also const across the face
  • similar for viewpoint -> shading is bad

Gouraud Smooth Shading

  • intensity/color interpolation shading
  • in WS: find I (intensity/color) at each vertex and illuminate vertices (normals)
  • in SS: interpolate across the polygon face using vertex normals
  • store normals along with vertices of the object faces

    Limitations

  • thin polygons not great for interp
  • rotating polygons -> see a polygon outline
  • specular reflection with larg polys at center and vertex
  • mach banding not eliminated (sharp color transitions of shades of the same color)

    Barycentric Interpolation

  • interpolate with percentages so points closer to one endpoint of a segment are more of the color we want
  • use with bilinear interpolation

    Bilinear interp

  • interp across 2 edges
  • usually along scanline and intersecting lines
  • do using collinearity with closest poly vertices
  • e.g., LOOOK
    • given
    • find scan line interps:
    • find bilinear interps from scanline interps:
  • Phong Smooth Shading

  • in WS: illuminate each point inside poly
  • in SS: interpolate across face using normals at each point
  • normal vector interpolation shading
  • calc intensity at each pixel
  • interp normals similar to others -> norm
  • more computation but looks smoother
  • Limitations

  • similar to Gouraud, polygon silhoutte

Non-Photorealistic Shading

  • determine colors based on normal directions
  • useful to create silhouttes