Dr' Scott Schaefer - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Dr' Scott Schaefer

Description:

Projection of an object onto a planar. surface (floor/wall) Build ... Image taken from 'Doom 3' 33 /42. Problems with Shadow Volumes. zero. zero 1 1 2 2 ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 43
Provided by: symo5
Category:
Tags: and | direction | doom | map | maps | of | ohio | schaefer | scott

less

Transcript and Presenter's Notes

Title: Dr' Scott Schaefer


1
Shadows
  • Dr. Scott Schaefer

2
Shadows
  • Shadows provide clues about depth
  • Make scenes appear
  • more realistic

3
Shadows
  • Shadows provide clues about depth
  • Make scenes appear
  • more realistic

4
Shadow Algorithms
  • Simple/Planar Shadows
  • Shadow Maps
  • Shadow Volumes

5
Simple/Planar Shadows
  • Projection of an object onto a planar
  • surface (floor/wall)
  • Build projection matrix
  • from light to wall
  • Draw object in black
  • using projection matrix

Image taken from http//developer.nvidia.com/objec
t/robust_shadow_volumes.html
6
Simple/Planar Shadows
  • Fast and simple
  • Does not account for self-shadowing
  • Only works for planar
  • surfaces (nothing else
  • has shadows cast on it)

Image taken from http//developer.nvidia.com/objec
t/robust_shadow_volumes.html
7
Shadow Maps
8
Shadow Maps
  • Render scene from lights perspective

9
Shadow Maps
  • Render scene from lights perspective

Shadow Map
10
Shadow Maps
  • Render scene from lights perspective
  • Render scene from
  • viewers perspective

11
Shadow Maps
  • Render scene from lights perspective
  • Render scene from
  • viewers perspective
  • For every pixel
  • Transform to world
  • space
  • Compare distance
  • to value in shadow map

12
Shadow Maps
  • Render scene from lights perspective
  • Render scene from
  • viewers perspective
  • For every pixel
  • Transform to world
  • space
  • Compare distance
  • to value in shadow map

13
Shadow Maps
  • Render scene from lights perspective
  • Render scene from
  • viewers perspective
  • For every pixel
  • Transform to world
  • space
  • Compare distance
  • to value in shadow map

In shadow!
14
Shadow Maps
  • Render scene from lights perspective
  • Render scene from
  • viewers perspective
  • For every pixel
  • Transform to world
  • space
  • Compare distance
  • to value in shadow map

In shadow!
15
Shadow Maps
  • Render scene from lights perspective
  • Render scene from
  • viewers perspective
  • For every pixel
  • Transform to world
  • space
  • Compare distance
  • to value in shadow map

Not in shadow!
16
Shadow Maps
Image taken from http//www.cse.ohio-state.edu/ha
leyb/Hardware/ggDepthBuffer.jpg
17
Shadow Maps
  • Advantages
  • Simple to implement
  • Does not depend on scene complexity (except to
    render shadow map)
  • Disadvantages
  • Fixed resolution image leads to artifacts
  • Omni-directional light sources require 6 shadow
    maps to cover every direction

18
Perspective Shadow Maps
  • Shadow maps are limited by screen resolution and
    depend on object distance!

Small distance
19
Perspective Shadow Maps
  • Shadow maps are limited by screen resolution and
    depend on object distance!

Huge distance
20
Perspective Shadow Maps
  • Distort viewing transformation from lights
    perspective to create a more uniform sampling
    from viewers perspective

Image taken from Perspective Shadow Maps
21
Perspective Shadow Maps
  • Distort viewing transformation from lights
    perspective to create a more uniform sampling
    from viewers perspective

Image taken from Perspective Shadow Maps
22
Anatomy of a Shadow
Surface outsideshadow volume (illuminated)
Shadowingobject


Lightsource
Shadowvolume (infinite extent)
Eye position (note that shadows are independent
of the eye position)
Surface insideshadow volume (shadowed)
Partially
shadowed
object
23
Shadow Volumes
  • Build polygons for shadow
  • volumes explicitly
  • Render shadow volume
  • polygons from viewers
  • perspective and count
  • inside/outside shadows

Image taken from Practical Robust Stenciled
Shadow Volumes for Hardware-Accelerated Rendering
24
Shadow Volumes
Lightsource
Shadowing object

25
Shadow Volumes
Lightsource
Shadowing object

zero
1
zero
2
2
1
3
26
Shadow Volumes
Lightsource
Shadowing object

zero
1
zero
Unshadowedobject
2
2
1
3
Shadow Volume Count 111-1-1-1 0
27
Shadow Volumes
Lightsource
Shadowing object

zero
1
zero
Shadowedobject
2
2
1
3
Shadow Volume Count 111-1 2
28
Shadow Volumes
Lightsource
Shadowing object

zero
1
zero
Unshadowedobject
2
2
1
3
Shadow Volume Count 0
29
Implementing Shadow Volumes
  • For each surface, find silhouette edges
  • Build shadow volume (viewer independent) by
    extending away from light

Image taken from Practical Robust Stenciled
Shadow Volumes for Hardware-Accelerated Rendering
30
Implementing Shadow Volumes
  • Use stencil buffer to count intersections with
    shadow volume
  • Render front faces and increment if closer to
    viewer
  • Render back faces and decrement if closer to
    viewer
  • Dont update color or depth values!!!!
  • If stencil buffer is non-zero, then pixel in
    shadow

Stencil value 1
Stencil value 0
Image taken from Practical Robust Stenciled
Shadow Volumes for Hardware-Accelerated Rendering
31
Shadow Volumes Examples
Images taken from Practical Robust Stenciled
Shadow Volumes for Hardware-Accelerated Rendering
32
Shadow Volumes Examples
Image taken from Doom 3
33
Problems with Shadow Volumes
Far clipplane
zero
1
1
2
zero
3
2
Near clipplane
34
Problems with Shadow Volumes
Missed shadow volume intersection due to near
clip plane clipping leads to mistaken count
Far clipplane
zero
1
1
2
zero
3
2
Near clipplane
35
Problems with Shadow Volumes
Lightsource
Shadowing object

Shadow test fails!
Shadow Volume Count 0
36
Solution Invert Depth Test
Lightsource
Shadowing object

Shadowed object
Shadow Volume Count -11-1-1
37
Solution Invert Depth Test
Lightsource
Shadowing object

Now have problem with far clipping plane
Shadowed object
Shadow Volume Count -11-1-1
38
Shadow Volumes
  • Advantages
  • Omni-directional light sources
  • Proper self-shadowing behavior
  • Pixel perfect shadows
  • Disadvantages
  • Surfaces must be connected closed
  • Surfaces can only use planar polygons
  • Silhouette computation uses CPU
  • Heavy on fill-rate
  • Near/Far clipping planes lead to problems

39
Soft Shadows
  • Point lights cause hard shadows
  • Lights are not infinitely small points in reality
  • Area light sources
  • cause soft shadows

http//graphics.ucsd.edu/henrik/images/cbox.html
40
Soft Shadows
  • Point lights cause hard shadows
  • Lights are not infinitely small points in reality
  • Area light sources
  • cause soft shadows

http//graphics.ucsd.edu/henrik/images/cbox.html
41
Soft Shadows
  • Simulate area lights with lots of points lights

Expensive
The cluster of point lights.
Image taken from Practical Robust Stenciled
Shadow Volumes for Hardware-Accelerated Rendering
42
Soft Shadows
  • Simulate area lights with lots of points lights
  • Blur shadows in image space

Cheap, inaccurate
http//www.gamedev.net/reference/articles/article2
193.asp
Write a Comment
User Comments (0)
About PowerShow.com