Lecture 19: (11/27) Graphics

by Mike Gleicher on November 24, 2012

(note: these notes were covered over 2+ days. day  1 we got through bump mapping, day 2 was all kinds of advanced mapping, leaving shadow volumes for day 3)

High Level Review: (see Lecture 7):

What are the goals of graphics for games?

  1. Fast (keep up the frame rate)
  2. Dynamic (respond to what’s going on)
  3. High Quality – works for the game
    1. works with the style (realism, cartoon, stylized, …)
    2. avoids visual artifacts
    3. provides enough cues
  4. Control / Authorability – we can get what we (or the art directory wants)
    1. without undue experimentation/work

Rendering Review

How does physics light a scene

Key concepts:

  • surface interactions and micro-geometry, subserface
  • local vs. non-local vs. global
  • direct vs. global
  • reflection vs. glossiness

Texture Mapping and Image-Based Stuff

Motivating Image-based methods

  • pre-rendered
  • sprites (depth ordering, alpha, …)
  • shape-changing sprites
  • texture maps
  • billboards / skyboxes / special cases
  • more general imposters
  • layers

Review

  • motivations
  • texture coordinate generation
  • filtering

Animation by fiddling with texture coordinates

Other texturing tricks

  • volumetric textures
  • world-space textures
  • slide projector textures
    • tool for lighting and shadows (later)

Other Maps

  • Surface properties
    • color
    • material properties (shinyness, glossiness)
    • local geometry (displacement map, normal/bump map, occlusion map)

Texturing Surfaces

Problem: still a flat surface

View Dependent Textures (very simple thing)

Displacement Maps (move geometry) – really messy to do

Bump Map / Normal Maps (move normals)

Parallax Mapping (constantly evolving)

  • depending on view direction, look somewhere else
  • walk along direction of ray (based on height)

Parrallax Occlusion Mapping (see gamedev.net)

walk along ray until you hit something

Relief Mapping (Manuel’s page) (paper)

  • use image warps to pre-compute the ray casts
  • where does the point go on the face of its bounding box
  • extend this to shadowing

Light Maps (of various forms)

  • pre-compute lighting on the surface (somehow)
  • keep it around as a texture
  • texture combining

Environment Maps

Basic version

  • small object / big world assumption
  • capture lighting box (envionment map)
    • box vs. sphere vs. cylinder
  • pure specular (reflections)
  • filtering issues

Environment Map Lighting?

  • Hack version (old car racing games)
    • earth is brown
    • sky is blue
    • lighting colored by direction

Environment maps to capture light

  • Captures all lights (direct and indirect)
    • from a distance, permanent in the scene
  • Issues
    • dynamic range (direct light much brighter than non)
    • so far only for specular
  • Idea 1 – sampling beyond the specular ray
    • issue – self-occlusions (ignore for now)
    • rays for glossy
    • rays for diffuse (lots)
  • Idea 2 – small samples (but area)
    • equivalence of samples and blur
    • pre-filtering (to make equivalence of lots of samples)
    • problem: how to pre-filter an environment map
      • MIP-MAP per cube wall? (what about corners?)
      • Spherical Harmonics
  • Why?
    • arbitrary complex lighting environments (not limited to number of lights)
    • specular reflections
    • glossiness
    • dynamic lighting? (re-render the environment map)

Shadows

Some basics

  • umbra / penumbra / lit area
  • hard vs. soft shadows
  • self shadowing

Hacky shadows can be useful! (ball over plane example)

Reasons why shadows are useful

Casting Shadows

Hierarchy of Hacks

  • Drop shadows (splotches) on floor
    • paint dark circles
    • paint light areas (spot-light)
    • how does this interact with existing colors
    • prospective hacks (for arbitrary point lights)

Shadow Maps (NOT light maps)

  • draw scene from the light’s point of view
  • use as colors (everything is shadowed, even things casting shadows)
  • use as items (so you can tell what is/isn’t shadowed)
  • use as depth
  • Gotchas
    • other than spotlights (cube environment maps?)
    • depth bias
    • item buffering doesn’t really work (very small polygons, moving)
    • get first and second objects (two depths)
    • aliasing (need high resolution to get sharp edges)

Shadow Volumes

  • basic idea (extrude each triangle)
  • point-in-frustum checks to see if in shadow
  • relatively efficient ways to use z-buffer and stencil buffers to perform checks
    • where you see the polygons, turn off lighting
    • 3 passes: draw z+dim, draw shadow volumes (stencil), draw bright (where not stenciled)
    • several ways to do mask pass
    • simple = (1) draw scene (dark) (2) draw back, things occluded get stenciled as on (since they are behind volume) (3) draw front (places where occluded is in front of voume) (4) un-shadow what’s not marked
  • Gotchas
    • need to combine/simplify geometry
    • expensive to do lots of fills 3 times

Towards more global illumination

Ambient Occlusion

    • soft shadows for self-shadowing
    • adds darkness where you get less light
    • independent of the direct lighting

Basic Ideas

Bent Normals

Implementation

  • ray sampling
  • multiple shadow drawing
  • multiple direction rendering
  • screen space methods
    • hack – estimate how much forward facing occlusion
    • naïve version does lots of texture reads
    • clever random sampling tricks to minimize reads (16?)

Why is AO so cool

  • easy and cheap
    • pre-computed for objects
    • SSAO for game scenes
  • gets major depth effects
    • dark in pockets
    • creases cause changes
    • low-frequency soft shadowing effects
Print Friendly, PDF & Email

Previous post:

Next post: