Shading refers to depicting depth perception in 3D models or illustrations by varying levels of darkness. In computer graphics, shading refers to the process of altering the color of an object in 3D scene, based on its angle to lights and its distance from lights to create a photorealistic effect.


Shading in Computer Graphics

  • Shading of flat polygons
    • Flat shading
      • compute illumination once per polygon and apply it to whole polygon or take color of first vertex
    • Gouraud shading
      • compute illumination at boundary and interpolate over the interior
    • Accurate shading
      • compute illumination at every point of the polygon
  • Flat shading
    • Intensity discontinuity across edge
    • If there are very large number of very small polygons, the faceting effects is not obvious
  • Gouraud shading
    • Interpolative
      • Given colors of the polygn vertices, interior points are colored through bilinear interpolation
    • Vertex normals vs. Face Normals
      • Use the actual surface’s normal at each vertex, when the surface is not analytically defined, take the average normal of all neighboring faces

    alt "color interpolation"

    • Advantages
      • “Color computation only at vertices”
        • illumination mode evaluation at vertex shader
        • Simple interpolation at fragment shader
      • Fast and easy
    • Disadvantages
      • “Color computation only at vertices”
      • Does not simulate the
  • Phong Shading
    • Basic idea
      • Interpolate surface normals
      • Compute color at each pixel from interpolated normals
      • Illumination model used at Fragment Shader
  • Further Problem No.1 - Polygonal silhouette
    • Subdivide further
      • Refinement only near silhouette
  • Further Problem No.2 - Orientation dependence
    • Note first that bilinear interpolation is done along horizontal scanlines
    • When orientation of the same polygon changes, the same point p may be colored differently
    • Solved by triangulate
  • Further Problem No.3 - Unrepresentative normal
    • Solved by subdivide surface