Shadows CS418 Computer Graphics John C. Hart Shadowing Shadows - - PowerPoint PPT Presentation

shadows
SMART_READER_LITE
LIVE PREVIEW

Shadows CS418 Computer Graphics John C. Hart Shadowing Shadows - - PowerPoint PPT Presentation

Shadows CS418 Computer Graphics John C. Hart Shadowing Shadows indicate light occlusion Fix object positions relative to each other Perspective Distortion screen y y view y clip -z z view 1 x view z


slide-1
SLIDE 1

Shadows

CS418 Computer Graphics John C. Hart

slide-2
SLIDE 2

Shadowing

  • Shadows indicate light occlusion
  • Fix object positions relative to each
  • ther
slide-3
SLIDE 3

Perspective Distortion

screen

  • z

y zview yview 1 yclip

view clip view

y y z  

view view view view view view view view view view view view

1 1 1 1 1 x z x x y y y z z z z z                                                                         

slide-4
SLIDE 4

Shadow Buffer

  • Williams, SIGGRAPH 78
  • Render scene twice from

viewpoint (x,y,z)screen = WPV (x,y,z)world – Once with light source on – Once only with ambient – Save a z-buffer

  • Render scene from light position

(x,y,z)light = WlPlVl (x,y,z)world – Save only z-buffer

  • For each viewpoint image pixel

compute (x,y,z)vis =WlPlVl V-1P-1W-1 (x,y,z)screen

  • If zvis < zlight at (x,y)vis = (x,y)light
  • Then pixel is in shadow

RGB Depth Viewpoint Light Position

slide-5
SLIDE 5

Shadow Buffer

  • Williams, SIGGRAPH 78
  • Render scene twice from

viewpoint (x,y,z)screen = WPV (x,y,z)world – Once with light source on – Once only with ambient – Save a z-buffer

  • Render scene from light position

(x,y,z)light = WlPlVl (x,y,z)world – Save only z-buffer

  • For each viewpoint image pixel

compute (x,y,z)vis =WlPlVl V-1P-1W-1 (x,y,z)screen

  • If zvis < zlight at (x,y)vis = (x,y)light
  • Then pixel is in shadow
slide-6
SLIDE 6

Shadow Buffer

  • Williams, SIGGRAPH 78
  • Render scene twice from

viewpoint (x,y,z)screen = WPV (x,y,z)world – Once with light source on – Once only with ambient – Save a z-buffer

  • Render scene from light position

(x,y,z)light = WlPlVl (x,y,z)world – Save only z-buffer

  • For each viewpoint image pixel

compute (x,y,z)vis =WlPlVl V-1P-1W-1 (x,y,z)screen

  • If zvis < zlight at (x,y)vis = (x,y)light
  • Then pixel is in shadow
slide-7
SLIDE 7

Shadow Buffer

  • Williams, SIGGRAPH 78
  • Render scene twice from

viewpoint (x,y,z)screen = WPV (x,y,z)world – Once with light source on – Once only with ambient – Save a z-buffer

  • Render scene from light position

(x,y,z)light = WlPlVl (x,y,z)world – Save only z-buffer

  • For each viewpoint image pixel

compute (x,y,z)vis =WlPlVl V-1P-1W-1 (x,y,z)screen

  • If zvis < zlight at (x,y)vis = (x,y)light
  • Then pixel is in shadow
slide-8
SLIDE 8

Shadow Buffer

  • Williams, SIGGRAPH 78
  • Render scene twice from

viewpoint (x,y,z)screen = WPV (x,y,z)world – Once with light source on – Once only with ambient – Save a z-buffer

  • Render scene from light position

(x,y,z)light = WlPlVl (x,y,z)world – Save only z-buffer

  • For each viewpoint image pixel

compute (x,y,z)vis =WlPlVl V-1P-1W-1 (x,y,z)screen

  • If zvis < zlight at (x,y)vis = (x,y)light
  • Then pixel is in shadow
slide-9
SLIDE 9

Numerical Analysis

slide-10
SLIDE 10

Percentage Closer Filtering

  • Reeves, Salesin, Cook,

SIGGRAPH 87

  • Shadow aliasing occurs when

numerical inaccuracy and discretization causes sample to compare to the wrong depth near an edge

  • Can be fixed by comparing

sample in a neighborhood (e.g. 3x3 pixels) and filtering the binary shadow answer

  • Can also be extended to

generate soft shadows