Day 12 - Shaders 2

Demo GPU Programs

World Space Lighting -

Dynamic Shaders -

UVs in shaders -

Checkerboard UVs -

Moving vertices -

Distorted Vertices -

Spiked Vertices -

Christmas Ornament -

Baking textures

  • Ambient Occlusion
  • Global illumination
  • Normal maps (bump Maps)
  • Displacement maps

Shadows on the GPU

  • "N64" style shadows - a circle below each object on perfectly flat ground.

  • Shadow maps

    • Place a camera at the position of each point light
    • Save the depth map and pass it as a parameter to each fragment shader
    • Compare each fragment's distance to the light with the store distance to the light
    • If the distance matches the stored distance, the point is illuminated, otherwise it is in shadow
  • Shadow maps pros/cons

    • Can run very quickly
    • Can produced "jagged" shadows
    • Simple smoothing can remove "jaggies"
    • Pixelated nature will produce some artifacts