An Efficient Hybrid Shadow Rendering Algorithm Eric Chan Frdo - - PowerPoint PPT Presentation

an efficient hybrid shadow rendering algorithm
SMART_READER_LITE
LIVE PREVIEW

An Efficient Hybrid Shadow Rendering Algorithm Eric Chan Frdo - - PowerPoint PPT Presentation

An Efficient Hybrid Shadow Rendering Algorithm Eric Chan Frdo Durand Massachusetts Institute of Technology Not Another Talk on Shadows?! Main ideas: combination of shadow maps + shadow volumes computation masks + Classic Shadow


slide-1
SLIDE 1

Eric Chan Frédo Durand Massachusetts Institute of Technology

An Efficient Hybrid Shadow Rendering Algorithm

slide-2
SLIDE 2

Not Another Talk on Shadows?!

Main ideas:

  • combination of shadow maps + shadow volumes
  • computation masks

+

slide-3
SLIDE 3

Classic Shadow Algorithms

Shadow maps (Williams 1978)

  • fast and simple
  • undersampling artifacts
  • lots of recent research!

Shadow volumes (Crow 1977)

  • bject-space
  • accurate
  • accelerated by stencil buffer
  • high fillrate consumption!

NVIDIA

slide-4
SLIDE 4

Fillrate Problem

Lots and lots of fillrate!

  • rasterization
  • stencil updates

Why?

  • polygons have large screen area
  • polygons overlap
slide-5
SLIDE 5

Fillrate Problem

Lots and lots of fillrate!

  • rasterization
  • stencil updates

Why?

  • polygons have large screen area
  • polygons overlap

But is this really a problem?

slide-6
SLIDE 6

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

slide-7
SLIDE 7

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
slide-8
SLIDE 8

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
  • per-pixel surface shading
slide-9
SLIDE 9

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
  • per-pixel surface shading
  • dynamic and projected lights
slide-10
SLIDE 10

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
  • per-pixel surface shading
  • dynamic and projected lights
  • atmospheric effects
slide-11
SLIDE 11

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
  • per-pixel surface shading
  • dynamic and projected lights
  • atmospheric effects
  • particle effects
slide-12
SLIDE 12

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
  • per-pixel surface shading
  • dynamic and projected lights
  • atmospheric effects
  • particle effects
  • shadow volumes
slide-13
SLIDE 13

But Is This Really A Problem?

Case study: Doom 3 engine (id Software)

  • bump mapping
  • per-pixel surface shading
  • dynamic and projected lights
  • atmospheric effects
  • particle effects
  • shadow volumes

50% 50%

“Shadowing accounts for about half of the game’s rendering time.” — John Carmack

slide-14
SLIDE 14

Two Observations

slide-15
SLIDE 15

Two Observations (shadow maps)

Shadow-map aliasing is ugly But — only noticeable at shadow silhouettes shadow silhouette

slide-16
SLIDE 16

Two Observations (shadow volumes)

Shadow volumes are accurate everywhere But — accuracy is only needed at silhouettes few silhouette pixels

slide-17
SLIDE 17

Hybrid Approach

Decompose the problem:

  • use shadow volumes at silhouettes
  • use shadow maps everywhere else

shadow map + shadow volume

slide-18
SLIDE 18

Algorithm

1. 3. 2. 4.

slide-19
SLIDE 19

Algorithm

1. 3. 2. 4. create a shadow map

slide-20
SLIDE 20

Algorithm

1. 3. 2. 4. find silhouette pixels

slide-21
SLIDE 21

Algorithm

1. 3. 2. 4. apply shadow volumes only at silhouette pixels

slide-22
SLIDE 22

Algorithm

1. 3. 2. 4. apply shadow maps everywhere else

slide-23
SLIDE 23

Algorithm Details

Questions:

  • how to find silhouette pixels?
  • how to rasterize only silhouette pixels?
slide-24
SLIDE 24

Find Silhouette Pixels

Silhouette pixels Look for depth discontinuities Use nearest 2x2 depth samples of the shadow map

slide-25
SLIDE 25

Find Silhouette Pixels (example)

shadow map query point Check results:

2 in shadow 2 visible

Disagreement!

silhouette pixel

slide-26
SLIDE 26

Restricted Rasterization

Use a mask to limit rasterization:

  • tag silhouette pixels in framebuffer
  • mask off all other pixels

example scene mask

slide-27
SLIDE 27

Computation Mask

We need a computation mask

  • user-specified mask
  • hardware early pixel rejection
  • reduces rasterization, shading, memory bandwidth

rasterizer framebuffer shading pixel tests normal pixel rejection early pixel rejection (e.g. per tile of 4x4 pixels)

slide-28
SLIDE 28

Hardware Support

Current hardware doesn’t have computation mask

  • but — hardware already has early z culling!
  • minimal changes needed for native mask support
  • ur implementation uses a simulated mask
slide-29
SLIDE 29

Results

  • 2.6 GHz Pentium 4
  • NVIDIA GeForce 6 (NV40) + crazy blue power supply
slide-30
SLIDE 30

Hybrid Algorithm Example

standard shadow map Aliased shadow of a ball

slide-31
SLIDE 31

Hybrid Algorithm Example Hybrid Algorithm Example

visualization Blue and red regions handled by shadow maps

slide-32
SLIDE 32

Hybrid Algorithm Example Hybrid Algorithm Example

visualization Blue and red regions handled by shadow maps Black and green regions handled by shadow volumes

slide-33
SLIDE 33

Hybrid Algorithm Example

hybrid algorithm standard shadow map

slide-34
SLIDE 34

Test Scenes

slide-35
SLIDE 35

Image Quality

slide-36
SLIDE 36

Shadow maps

slide-37
SLIDE 37

Silhouettes

slide-38
SLIDE 38

Reconstruction

slide-39
SLIDE 39

Hybrid Shadow maps Time: 19 ms Time: 5 ms

slide-40
SLIDE 40

Shadow volumes Hybrid Time: 48 ms Time: 19 ms

slide-41
SLIDE 41

Artifacts

Low-resolution shadow map discretization errors Misclassified silhouette pixels missing features Difficult cases: fine geometry

slide-42
SLIDE 42
slide-43
SLIDE 43
slide-44
SLIDE 44

Example of Missing Features

256x256 1024x1024 result visualization

slide-45
SLIDE 45

Discussion

Algorithm designed to help fillrate-bound applications:

  • requires an extra rendering pass
  • 30% to 100% speedup in our test scenes
  • performance depends a lot on culling hardware

More details in the paper and web page ...

  • tradeoff analysis
  • comparison to related work
  • implementation details
  • more performance and image comparisons
slide-46
SLIDE 46

Summary

Hybrid shadow algorithm Screen-space decomposition:

  • most pixels use fast (but inexact) algorithm
  • a few pixels use accurate (but expensive) algorithm

+

slide-47
SLIDE 47

Computation Masks

Why?

  • pixels are not created equal
  • programmer marks “interesting” pixels
  • fast reject all other pixels
  • not just for shadows!
  • useful in general for multipass algorithms
  • hardware is (mostly) already there
slide-48
SLIDE 48

Acknowledgments

Nick Triantos and Mark Kilgard (NVIDIA) Jan Kautz and Addy Ngan (MIT) Timo Aila ASEE NDSEG Fellowship