09 Shadow Mapping Steve Marschner CS5625 Spring 2019 Thanks to - - PowerPoint PPT Presentation

09 shadow mapping
SMART_READER_LITE
LIVE PREVIEW

09 Shadow Mapping Steve Marschner CS5625 Spring 2019 Thanks to - - PowerPoint PPT Presentation

09 Shadow Mapping Steve Marschner CS5625 Spring 2019 Thanks to previous instructor Kavita Bala Shadows as depth cue [tricks-and-illusions.com] Shadows as anchors Shadows as anchors [Mller et al. RTR ] Mark Kilgard Mark Kilgard Mark


slide-1
SLIDE 1

09 Shadow Mapping

Steve Marschner CS5625 Spring 2019

Thanks to previous instructor Kavita Bala

slide-2
SLIDE 2

Shadows as depth cue

[tricks-and-illusions.com]

slide-3
SLIDE 3

Shadows as anchors

slide-4
SLIDE 4

Shadows as anchors

slide-5
SLIDE 5
slide-6
SLIDE 6
slide-7
SLIDE 7

[Möller et al. RTR]

slide-8
SLIDE 8

Mark Kilgard

slide-9
SLIDE 9

Mark Kilgard

slide-10
SLIDE 10

Mark Kilgard

slide-11
SLIDE 11

Mark Kilgard

slide-12
SLIDE 12

slide courtesy of Kavita Bala, Cornell University

Shadow Map Issues

  • if A and B are approximately equal?
  • Speckling
slide-13
SLIDE 13

Mark Kilgard

slide-14
SLIDE 14

Mark Kilgard

slide-15
SLIDE 15

Mark Kilgard

slide-16
SLIDE 16
  • pengl-tutorial.org

first try at shadow mapping

slide-17
SLIDE 17

Mark Kilgard not enough shadow bias good shadow bias too much shadow bias

slide-18
SLIDE 18
  • pengl-tutorial.org

shadow mapping with constant bias

slide-19
SLIDE 19
  • pengl-tutorial.org

shadow mapping with slope-dependent bias

slide-20
SLIDE 20
  • pengl-tutorial.org

closed surfaces and slope-dependent bias

slide-21
SLIDE 21
  • pengl-tutorial.org

adding percentage-closer filtering

slide-22
SLIDE 22

Shadow map sample rate—bad case

Light behind object Light’s “view direction” almost


  • pposite the eye’s view


direction “Dueling frusta”

Mark Kilgard eye view light view

slide-23
SLIDE 23

Cascaded shadow maps (aka. parallel-split SM)

[Möller et al. RTR]

slide-24
SLIDE 24

Single shadow map, 2048x2048 Four 1024x1024 shadow maps (equal memory)

Fan Zhang, Chinese U. Hong Kong

slide-25
SLIDE 25

Filtering shadow maps

Shadow map lookups cause aliasing, need filtering As with normal maps, pixel is a nonlinear function of the shadow depth

  • this means applying a linear filter to the depth is wrong

We want to filter the output, not the input, of the shadow test

  • what fraction of samples pass the test
  • samples pass the test if they are closer than the shadow map depth
  • therefore “percentage closer filtering” or PCF
slide-26
SLIDE 26

Kavita Bala, Computer Science, Cornell University

Percentage Closer Filtering

  • Soften the shadow to decrease aliasing

– Reeves, Salesin, Cook 87 – GPU Gems, Chapter 11

slide-27
SLIDE 27

Kavita Bala, Computer Science, Cornell University

1 sample SM

slide-28
SLIDE 28

Kavita Bala, Computer Science, Cornell University

4 sample PCF

slide-29
SLIDE 29

Kavita Bala, Computer Science, Cornell University

16 sample PCF

slide-30
SLIDE 30

Kavita Bala, Computer Science, Cornell University

slide-31
SLIDE 31

Soft shadows from small sources

Main effect is to blur shadow boundaries

  • PCF can do this
  • …but how wide to make the filter?

Real shadows depend on area of light visible from surface

  • this can vary in complex ways
  • example: sun viewed through leafy trees

Useful approximation: convolution

  • shadows are convolutions when the blocker and source are parallel and planar
  • occluder fusion: approximating some occluding geometry as a planar blocker
slide-32
SLIDE 32

Hard Shadows

Completely lit Umbra

Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course

slide-33
SLIDE 33

Soft Shadows

Completely lit Umbra Penumbra

Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course

slide-34
SLIDE 34

Shadow Hardening on Contact

Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course

slide-35
SLIDE 35

Percentage‐Closer Soft Shadows

Average occluder depth

  • Shadow map
  • 1. Blocker search

Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course

slide-36
SLIDE 36

Percentage‐Closer Soft Shadows

  • 1. Blocker search
  • 2. Penumbra width estimation

Planar

  • ccluder
  • Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course
slide-37
SLIDE 37

Percentage‐Closer Soft Shadows

  • 1. Blocker search
  • 2. Penumbra width estimation
  • 3. Filtering
  • Filter region

(size ~ ) 50%

Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course

slide-38
SLIDE 38

Percentage-closer soft shadows

Fernando, NVidia whitepaper ~2005