the university of north carolina at chapel hill practical logarithmic rasterization for low error...
TRANSCRIPT
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Practical logarithmic rasterization for low error shadow maps
Brandon LloydUNC-CHNaga GovindarajuMicrosoftSteve Molnar NVIDIADinesh Manocha UNC-CH
2
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Shadows
Shadows are important aid spatial reasoningenhance realismcan be used for dramatic effect
High quality shadows for real-time applicationsremains a challenge
3
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Shadow approaches
Raytracing [Whitted 1980] not yet real-time for complex, dynamic scenes at high resolutions
Shadow volumes [Crow 1977] can exhibit poor performance on complex scenes
4
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
LightEye
Shadow maps [Williams 1978]
5
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic perspective shadow maps (LogPSMs) [Lloyd et al. 2007]
Standard shadow map LogPSM
6
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic perspective shadow maps (LogPSMs) [Lloyd et al. 2007]
Standard shadow map LogPSM
7
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Goal
linear rasterization logarithmic rasterization
Perform logarithmic rasterization at rates comparableto linear rasterization
8
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
BackgroundHandling aliasing errorLogPSMs
Hardware enhancementsConclusion and Future work
9
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
High resolution shadow maps
Requires more bandwidth
Decreases shadow map rendering performance
Requires more storage
Increased contention for limited GPU memory
Decreased cache coherence
Decreases image rendering performance
Poor shadowmap querylocality
10
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Sample at shadow map query positions
No aliasing
Uses irregular data structures
requires fundamental changes to graphics hardware [Johnson et al. 2005]
Irregular z-buffer[Aila and Laine 2004;Johnson et al. 2004]
11
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]
Multiple shadow frusta [Forsyth 2006]
12
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Adaptive partitioning
Requires scene analysisUses many rendering passes
13
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Scene-independent schemes
Match spacing between eye samplesFaster than adaptive partitioning
no scene analysis few render passes eye sample spacing
14
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Cascaded shadow maps [Engel 2007] Parallel split shadow maps [Zhang et al. 2006]
Cascade shadow maps
15
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Projective warping
Perspective shadow maps (PSMs) [Stamminger and Drettakis 2002]
Light-space perspective shadow maps (LiSPSMs) [Wimmer et al. 2004]
Trapezoidal shadow maps (TSMs)[Martin and Tan 2004]
Lixel for every pixel [Chong and Gortler 2004]
16
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Projective warping
Not necessarily the best spacing distribution
PSM LiSPSM
hig
h e
rror
low error
mod
era
te e
rror
moderate error
y
x
17
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic+perspective parameterization
Perspectiveprojection
Logarithmictransform
Resolutionredistribution
18
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Size of the shadow map* required to remove aliasing
error(ignoring surface orientation)
Uniform
Perspective
Logarithmic + perspective
Bandwidth/storage savings
- near and far plane distances of view frustum
*shadow map texels / image pixels
19
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Single shadow map LogPSM
LogPSMs havelower maximum errormore uniform error
Image resolution: 5122
Shadow map resolution: 10242
f/n = 300Grid lines for every 10 shadow map texels Color coding for maximum texel extent in image
LiSPSM
LogPSMLiSPSM
LogPSM
>107.753.2511113.257.7510< >107.753.2511113.257.7510<
20
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Comparisons
21
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
More details
Logarithmic perspectiveshadow maps
UNC TR07-005
http://gamma.cs.unc.edu/logpsm
22
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
BackgroundHardware enhancements
rasterization to nonuniform gridgeneralized polygon offsetdepth compression
Conclusion and Future work
23
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Graphics pipeline
fragment processor
vertex processor
rasterizer
alpha, stencil, & depth tests
blending
clipping
memoryinterface
depthcompression
colorcompression
setup
24
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Rasterization
Coverage determinationcoarse stage – compute covered tiles fine stage – compute covered pixels
Attribute interpolationinterpolate from verticesdepth, color, texture coordinates, etc.
25
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Signs used to compute coverageWater-tight rasterization
Use fixed-point fixed-point “snaps” sample locations to an underlying uniform grid
Edge equations
+++ -+++-+
++-
26
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Attribute interpolation
Same form as edge equations:
27
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic rasterization
light space linear shadow mapspace
warped shadow mapspace
Linear rasterization with nonuniform grid locations.
y
x
y'
x
28
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Edge and interpolation equations
Monotonicexisting tile traversal algorithms still workoptimizations like z-min/z-max culling still work
29
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coverage determinationfor a tile
Full parallel implementation
Full evaluation
30
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Per-triangle constants
Coverage determination for a tile
Incremental in x
Full evaluationIncremental x
1 2
31
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Generalized polygon offset
texelwidth
- depth slope
- smallest representable depth difference
constant
light
32
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Generalized polygon offset
texelwidth
- depth slope
- smallest representable depth difference
constant
not constant
light
33
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Generalized polygon offset
Do max per pixelSplit polygonInterpolate max at end points
34
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Depth compression
Important for reducing memory bandwidth requirementsExploits planarity of depth valuesDepth compression survey [Hasselgren and Möller 2006]
depthcompressor
tile
tile table
store compressed
yes
store uncompressedno
fits in bitbudget?
35
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Depth compression - Standard
compresseduntouchedclamped
Linear depth compressionOur depth compression
Resolution:512x512
36
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Depth compression - LiSPSM
compresseduntouchedclamped
Linear depth compressionOur depth compression
Resolution:512x512
37
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Depth compression - LogPSM
compresseduntouchedclamped
Linear depth compressionOur depth compression
Resolution:512x512
38
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Depth compression – LogPSM Higher resolution
compresseduntouchedclamped
Linear depth compressionOur depth compression
low curvature
Resolution:1024x1024
39
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
ΔxΔxΔx
ΔxΔxΔx
ΔxΔxΔx
ΔxΔxΔx
Δy
Δy
Δy
z0
dd
dda0
a1dd
ddz0
Δy Δy
Δy
Δy
Δx
24 3 6 3
10 3 16 3
18 3 10 3
10 3 9 3
Differentialencoding
Anchor encoding 128-bit allocationtable
Our compression scheme
40
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Test scenes
Town model• 58K triangles
Robots model• 95K triangles
Power plant• 13M triangles • 2M rendered
41
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Compression methods tested
Anchor encoding[Van Dyke and Margeson 2005]
Differential differential pulse code modulation (DDPCM)[DeRoo et al. 2002]
Plane and offset[Ornstein et al. 2005]
Hasselgren and Möller [2006]
42
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Compression results
256 512 1024 20480
20
40
60
80
100
Com
pres
sed
size
(%
)
Resolution
Linear Rasterization
Our algorithm
Anchor [VM05]
DDPCM [DMFW02]
Plane & depth offset [OPS*05]
Hasselgren and Möller [HA06]
256 512 1024 20480
20
40
60
80
100 Logarithmic Rasterization
Com
pres
sed
size
(%
)
Resolution
Our algorithm
Anchor [VM05]
DDPCM [DMFW02]
Plane & depth offset [OPS*05]
Hasselgren and Möller [HA06]
Average compression over paths through all modelsVarying light and view direction
43
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
256 512 1024 20480
20
40
60
80
100
Com
pres
sed
size
(%
)
Resolution
Linear Rasterization
Our algorithm
Anchor [VM05]
DDPCM [DMFW02]
Plane & depth offset [OPS*05]
Hasselgren and Möller [HA06]
256 512 1024 20480
20
40
60
80
100 Logarithmic Rasterization
Com
pres
sed
size
(%
)
Resolution
Our algorithm
Anchor [VM05]
DDPCM [DMFW02]
Plane & depth offset [OPS*05]
Hasselgren and Möller [HA06]
Compression results
Anchor encoding best linear method
higher tolerance for curvature
44
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Summary of hardware enhancements
Apply F(y) to vertices in setuplog and multiply-add operations
Evaluators for G(y’)exponential and multiply-add operations
Possible increase in bit width for rasterizer Generalized polygon offsetNew depth compression unit
can be used for both linear and logarithmic rasterization
45
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Feasibility
Leverages existing designsTrades computation for bandwidthAligns well with current hardware trends
computation cheapbandwidth expensive
46
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conclusion
Shadow mapsHandling errors requires high resolution
Logarithmic rasterization significant savings in bandwidth and storage
Incremental hardware enhancements
Rasterization to nonuniform gridGeneralized polygon offsetDepth compression
Feasibleleverages existing designsaligns well with hardware trends
47
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Future work
Prototype and more detailed analysis Greater generalization for the rasterizer
reflections, refraction, caustics,multi-perspective rendering [Hou et al. 2006; Liu et al. 2007]
paraboloid shadow maps for omnidirectional light sources [Brabec et al. 2002]
programmable rasterizer?
48
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Acknowledgements
Jon Hasselgren and Thomas Akenine-Möller for depth compression codeCorey Quammen for help with videoBen Cloward for robots modelAaron Lefohn and Taylor Halliday for town model
49
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Acknowledgements
Funding agenciesNVIDIA University FellowshipNSF Graduate FellowshipARO Contracts DAAD19-02-1-0390 and W911NF-04-1-0088NSF awards 0400134, 0429583 and 0404088DARPA/RDECOM Contract N61339-04-C-0043Disruptive Technology Office.
50
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Questions
51
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Precisiondepends on resolution in y and
Inputs limited to 24 bits of precision(floating point mantissa)
52
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Generalized polygon offset
fFor flythroughs in our test scenes:
Split situation occured for 1% of polygonsAverage was .001
53
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coverage determinationfor a tile
Incremental in y
Full evaluationIncremental xIncremental y
1
32Per-frame constants
54
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coverage determinationfor a tile
Look up table
Full evaluationIncremental xIncremental yLUT
21Per-frameconstants
55
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coverage determinationfor a tile
Look up table
Full evaluationIncremental xIncremental yLUT
32
1
Per-frameconstants
56
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Comparisons
Standard FP+Perspective ZP5+Perspective FP+Log+Perspective
57
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Equal error
29002 (4096x2053) 5122 (210x1248)
LiSPSM LogSPSM
58
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Simulating logarithmic rasterization
Apply F(y) in vertex programrequires fine tesselation to avoid errorincreases vertex transformation load
Brute-force rasterization with a fragment program
disables optimizations due to depth writes