Practical logarithmic rasterization for low error shadow maps

Download Report

Transcript Practical logarithmic rasterization for low error shadow maps

Logarithmic perspective
shadow maps
Brandon Lloyd1,2
Naga Govindaraju2
Cory Quammen1
Steve Molnar3
Dinesh Manocha1
1University
of North Carolina
– Chapel Hill
2Microsoft
3NVIDIA
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Goal
Low error shadows for
real-time applications
Emphasis on performance
2
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Standard Shadow Map
aliasing
3
undersampled
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Perspective Warping
4
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic Perspective
Warping
6
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
Related work
Logarithmic perspective warping
Error analysis
Experimental results
Conclusion
7
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Single shadow map warping
Perspective shadow maps
(PSMs)
[Stamminger and Drettakis 2002]
Light-space perspective
shadow maps (LiSPSMs)
[Wimmer et al. 2004]
Trapezoidal shadow maps
[Martin and Tan 2004]
8
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Single shadow map warping
Warping cannot be used
for all light directions
9
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Face partitioning
Perspective warped
cube maps
[Kozlov 2004]
10
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
z-partitioning
Cascaded shadow maps
[Engel 2007]
Parallel split shadow
maps [Zhang et al. 2006]
Separating-plane
shadow maps
z
[Mikkelsen 2007]
11
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
z-partitioning
Cascaded shadow maps
[Engel 2007]
Parallel split shadow
maps [Zhang et al. 2006]
Separating-plane
shadow maps
z
[Mikkelsen 2007]
12
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Adaptive partitioning
Adaptive shadow maps
[Fernando et al. 2001]
Queried virtual shadow maps
[Geigl and Wimmer 2007]
Fitted virtual shadow maps
[Geigl and Wimmer 2007]
Resolution matched shadow maps
[Lefohn et al. 2007]
Tiled shadow maps
[Arvo 2004]
Multiple shadow frusta
[Forsyth 2006]
13
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Irregular z-buffer
[Aila and Laine 2004;
Johnson et al. 2004]
GPU implementations
[Arvo 2006; Sintorn et al. 2008]
Hardware architecture
[Johnson et al. 2005]
14
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Methods for better sampling
Scene-independent
Single SM warping + Lower, nearly constant cost
Face partitioning
– Higher error
z-partitioning
Scene-dependent
Adaptive
Irregular
15
+ Lower error
– Higher, variable cost
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Filtering
Percentage closer filtering
[Reeves et al. 1987]
Variance shadow maps
[Donnely and Lauritzen 2006;
Lauritzen and McCool 2008]
Convolution shadow maps
[Annen et al. 2007]
Exponential shadow maps
[Salvi 2008; Annen et al. 2008]
16
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Standard Shadow Map
17
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Standard Shadow Map
18
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Perspective Warping
19
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic Perspective
Warping
20
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic perspective
shadow maps (LogPSMs)
Replace perspective warping in
scene-independent
single shadow map
z-partitioning
face partitioning
Similar performance with less error
Similar error with less texture
resolution
21
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
Related work
Logarithmic perspective warping
Error analysis
Experimental results
Conclusion
22
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Perspective warping
Not necessarily the best fit to required
sampling distribution
PSM
high error
moderate error
LiSPSM
y
x
low error
23
moderate error
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
y
x
Perspective
projection
24
low error
high error
Logarithmic+perspective
warping
Logarithmic
transform
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic rasterization
Brute-force rasterization
use a fragment program
Slower than standard
rasterization
disables optimizations
• z-culling
• double-speed z-only rendering
breaks linear depth compression schemes
25
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic rasterization
Hardware rasterization
[Lloyd et al. 2007]
equivalent to rasterizing on non-uniform grid
requires incremental modifications
Software rasterization
Larrabee [Seiler et al. 2008]
Performance comparable to standard
rasterization
26
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
Related work
Logarithmic perspective warping
Error analysis
Experimental results
Conclusion
27
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Error analysis
Need more analysis for previous
methods
little analysis for point lights
limited analysis for lights in general position
[Tadamura et al. 1999; Zhang et al. 2006]
28
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Combinations of algorithms
P
LogP
ZP
FP
single SM
Standard
P
LogP
29
-
Perspective warping
Logarithmic perspective warping
z-partitioning
face partitioning
z-partitioning
ZP
ZP+P
ZP+LogP
face-partitioning
FP+P
FP+LogP
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Combinations of algorithms
P
LogP
ZP
FP
single SM
Standard
P for the
LogP
-
Perspective warping
Logarithmic perspective warping
z-partitioning
face partitioning
z-partitioning
ZP
ZP+P
fewest
shadow
ZP+LogP
face-partitioning
Which algorithm gives the least error
maps?FP+P
30
FP+LogP
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Quantifying aliasing error
shadow map
light
light image
plane
eye
eye image
plane
31
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Quantifying aliasing error
shadow map
light
light image
plane
eye
eye image
plane
32
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Quantifying aliasing error
shadow map
light
light image
plane
Maximum error:
eye
eye image
plane
33
over a light ray
over the frustum
over all light positions
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Near optimal, sceneindependent warping
Minimizes maximum error over a face
Too complicated for practical use
Used as a baseline
34
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Maximum error
over all light positions
Param.
End face
Side face - s
Side face - t
Side face combined
Uniform
Perspective
Log+Persp.
Near optimal
Logarithmic perspective warping is about the best
we can do for scene-independent algorithms
35
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Error distribution along a face
Uniform
LiSPSM
PSM
LogPSM
15
10
5
0
0near
0.5
v
Uniform
36
20
eerror
p;t
in t
maxM
e
error
maxM
p;s in s
20
far1
LiSPSM
15
10
5
0
0near
PSM
0.5
v
far1
LogPSM
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Maximum error
for varying light directions
max error (log2 scale)
25
Standard
Perspective
Log+perspective
20
15
direction
to light
10
5
0
20
37
40
60
80
view
direction
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Maximum error
for varying light directions
max error (log2 scale)
25
Standard
Perspective
Log+perspective
FP+LogP
20
15
direction
to light
10
5
0
20
38
40
60
80
view
direction
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
k= 1
25
k= 2
25
20
20
15
15
10
10
10
5
5
5
0
0
0
20
40
60
80
20
error reduction
20
15
60
80
20
k= 7
25
15
15
15
error reduction
10
10
10
5
5
5
0
0
0
°
60
80
20
40
°
60
80
60
k = 16
25
20
error reduction
40
ZPk
ZPk+P
ZPk+LogP
FPcs+LogP
FPc+LogP
°
20
40
error reduction
°
k= 5
20
39
40
20
2
max error
(log2 scale)
log S
°
25
k= 3
25
2
max error
(log2 scale)
log S
z-partitioning
80
error reduction
20
40
60
FP uses 1-7
partitions
(3.8 average)
80
°
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
k= 1
25
k= 2
25
k= 3
25
20
20
20
15
15
15
10
10
10
5
5
5
0
0
0
ZPk
ZPk+P
ZPk+LogP
FPcs+LogP
FPc+LogP
2
max error
(log2 scale)
log S
Least error for
fewest shadow maps?
20
40
60
80
20
60
80
20
°
k= 5
25
40
60
80
°
k= 7
25
40
k = 16
25
20
20
20
15
15
15
10
10
10
5
5
5
0
0
0
FP uses 1-7
partitions
(3.8 average)
2
max error
(log2 scale)
log S
°
20
40
°
40
60
80
20
40
°
60
80
20
40
60
80
°
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
Related work
Logarithmic perspective warping
Error analysis
Experimental results
Conclusion
41
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Single shadow map LogPSM
LogPSMs have
lower maximum error
more uniform error
LiSPSM
LogPSM
LiSPSM
LogPSM
42
Image resolution:
5122
Shadow map resolution:
10242
f/n = 300
Grid lines for every 10 shadow map
texels
Color coding for maximum texel extent
in image
<
1
1
10 7.75
1
3.25
1
3.25
7.75
>10
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Partitioning schemes
Standard
43
FP+P
ZP5+P
FP+LogP
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Comparison video
44
PSM = LiSPSM with PSM
parameter
Cascaded = ZP5
The UNIVERSITY
of NORTH CAROLINA at CHAPEL HILL
LogPSM
= FP+LogP
Point lights
45
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point lights
<
1
1
10 7.75
46
1
3.25
1
3.25
7.75
>10
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Limitations of LogPSMs
Not currently supported in hardware
Share problems as other warping
algorithms:
do not handle aliasing error due to surface
orientation
face partitioning needed for most benefit
• not as simple as z-partitioning
• can exhibit shearing artifacts
47
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conclusion
LogPSMs
Single shadow map
z-partitioning
face partitioning
Error analysis
LogPSMs are close to optimal for sceneindependent algorithms
LogPSMs achieve low error with few shadow
maps
48
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Future work
Other error metrics [Zhang et al. 2007]
Combine with scene-dependent
algorithms
LiSPSM + adaptive [Giegl and Wimmer 2007]
LiSPSM + irregular [Sintorn et al. 2008]
49
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Acknowledgements
Aaron Lefohn and Taylor Holliday for town model
Ben Cloward for robot model
David Feng and Nico Galoppo
Funding agencies
NVIDIA University Fellowship
NSF Graduate Fellowship
ARO, NSF, DARPA/RDECOM, Disruptive Technology Office
50
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Questions
51
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Face partitioning
Low error over all light positions
Omnidirectional lights
52
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
z-partitioning
In effect reduces f/n
f
n
0
53
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
z-partitioning
In effect reduces f/n
Costly for omnidirectional lights
f
n
0
54
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Future work
Incorporate rough scene information
use a ‘pseudo-near plane’ [Lloyd 2007]
higher
error
low error
pseudo-near
plane
55
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Scene-independent
maximum error
Standard
56
FP+P
ZP5+P
FP+LogP
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Handling shear
57
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Handling shear
58
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL