Single Sample Soft Shadows Using Depth Maps - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Single Sample Soft Shadows Using Depth Maps

Description:

... samples gives smoother penumbra. many samples = expensive rendering ... Define properties that affect size of penumbra. Integrate those into the search scheme ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 36
Provided by: stefan65
Category:

less

Transcript and Presenter's Notes

Title: Single Sample Soft Shadows Using Depth Maps


1
Single Sample Soft Shadows Using Depth Maps
  • Stefan Brabec and Hans-Peter Seidel
  • Max-Planck-Institut für Informatik

2
Overview
  • Introduction
  • Single sample soft shadows withdepth maps
  • Implementation
  • Results
  • Conclusion Future Work

3
Introduction
  • Good-looking shadows greatly improve quality of
    rendered images
  • For interactive applications mostly hard-shadows
    are used

4
Hard vs. Soft Shadows
  • Hard Shadows
  • Point light / directional light
  • Fast rendering
  • Shadow Volumes, Shadow Mapping
  • Soft Shadows
  • Area light / volume light
  • Slow rendering
  • Sampling the light source

5
Soft Shadows
  • E.g. sampling the area light source
  • Needs a number of hard-shadow calculations and
    accumulates the results
  • More samples gives smoother penumbra

many samples expensive rendering
6
Soft Shadow Example
  • Ground plane shadows

1. Initialize FB (white) 2. For each sample point
do 2a. Render scene 2b. Subtract 1/N from
FB only once for each pixel
(stencil) !
Image from ATI Developers Site
7
Parkers Method
  • Soft shadows for point lights
  • Adding an outerhull to an object
  • Rays inside outerhull are attenuated

8
Parkers Method
  • Each ray is attenuated according to distance to
    inner object

9
Parkers Method
  • Pros
  • Minimal overhead for ray casting(speed
    implementation work)
  • Cons
  • Not suitable for hardware rendering
  • Adds only an outer penumbra very thick shadows

10
Our Method
  • Parkers idea adapted for hardware rendering ?
  • Use sampled input data (depth maps)
  • Shadow map algorithm
  • Concept of extended occluders
  • Search for hard shadow/lit regions
  • But
  • Penumbra for outer and inner regions

11
Shadow Mapping
  • Render depth map from light position
  • Render from camera and comparetransformed z
    coordinate with depthstored in lights depth map

12
Shadow Mapping
13
Computing Hard Shadows
  • Given two depth maps (light cam)we compute
    shadows as

foreach(x,y) P (x,y,depth_camerax,y) P
warp_to_light(P) if( depth_lightPx,Py lt Pz
) pixel is blocked else pixel is lit
14
Adding Outer Penumbra
  • Adding an outer penumbra regionto this hard
    shadow

foreach(x,y) P (x,y,depth_camerax,y) P
warp_to_light(P) if( depth_lightPx,Py lt Pz
) pixel is blocked else pixel is lit
lit or outer penumbra ?
15
Adding Outer Penumbra
  • Add penumbra by searching forthe nearest hard
    shadow
  • Use (Px,Py) as the starting point
  • Search neighborhood fora nearby pixel that is in
    hard shadow
  • When a maximum search radius is reached then
    pixel is completely lit

16
Adding Outer Penumbra
  • Project Search

17
Adding Outer Penumbra
  • Assign attenuation value
  • f rises up from 0 (no illum) to 1 (full illum)
  • To do
  • Define properties that affect size of penumbra
  • Integrate those into the search scheme

hard shadow found
maximal extend
18
Adding Outer Penumbra
  • Distance receiver/light

larger penumbra
19
Adding Outer Penumbra
  • Distance receiver/light
  • Varying rmax according to this distance

depth map search
20
Adding Outer Penumbra
  • Distance receiver/occluder

larger penumbra
21
Adding Outer Penumbra
  • Distance receiver/occluder
  • Is known when a (possible) occluderis found
    (inside the rmax region)
  • Dim f based on this distance
  • Keep searching in rmax for minimum f

22
Adding Outer Penumbra
  • Distance receiver/occluder

r
m
a
x
P

depth map search
23
Outer Penumbra Algorithm
search(P) rmax Pz fmin 1 search r
inside rmax found blocker at r ? rmax
rmax (Pz - depth_lightat r) f
clamp01(r/ rmax) fmin min(f, fmin ) return
fmin
receiver/light
receiver/occluder
24
Adding Inner Penumbra
  • Previous slide
  • Algorithm that adds a penumbra to the hard
    shadow (like Parkers method)
  • Better
  • Penumbra region that also smoothesthe inner
    region

25
Adding Inner Penumbra
  • Search scheme can also be appliedto inner
    regions

c is user defined constant where inner and outer
meet (e.g. 0.5)
26
Self Shadowing Problem
  • Problem when searchingwith constant Pz
  • Surface can shadowitself

27
Self Shadowing Problem
  • Solutions
  • Divide scene into disjunct occludersand
    receivers
  • Better additional search criterion
  • Assign object IDs (like Hourcade)
  • IDs should group logical, spatially
    relatedobjects
  • Outer penumbra search id_light.. ! PID
  • Inner penumbra search id_light.. PID

28
Self Shadowing Problem
  • Object IDs
  • May also fail if distinct objects are nearly
    adjacent
  • No self-shadowing with soft shadows
  • Use hard shadow for such cases
  • No automatic ID assignment (yet)
  • Simply used scene graph structure

29
Implementation
  • Generating the input data
  • Render depth id map fromlight source position
  • e.g. store (ID mod 256) in stencil bufferand
    read back 24/8 packed depth_stencil
  • Render depth id map fromcamera position

30
Implementation
  • Shadow computation
  • Render light camera id/depth map
  • read back to host memory
  • Perform search
  • Result attenuation map(window resolution)
  • Use attenuation map to modulate light source
    contribution

31
Implementation
  • Subpixel Accuracy
  • Keep fractional partwhen warping P to P
  • Reduces quantizationartifacts

32
Implementation
  • Adaptive Sampling
  • Reduce number of searches
  • Start with one search per NxN block
  • Refine when
  • Object IDs differ
  • Hard shadow results differ
  • If not, interpolate region
  • Row / Column refinement

33
Implementation
  • Example ID of 3 differs from rest

34
Results
35
Results
36
Results
37
Results
38
Results
39
Conclusions
  • Good looking, soft penumbra regionsusing only
    information obtained froma single light source
    sample
  • Independent of scene complexity
  • like shadow mapping
  • Runs at interactive frame rates
  • Also suitable for ray tracing

40
Future Work
  • Control of penumbra size
  • Frustum settings / rmax affect size
  • Better define area light in scene units
  • Cases where object ID method fails
  • Nearby objects
  • Self-shadowing with soft shadows ?
  • Speed-Up
  • Distance map ?

41
Thank You !
Write a Comment
User Comments (0)
About PowerShow.com