Practical Logarithmic Shadow Maps Brandon Lloyd UNCCH Naga
Practical Logarithmic Shadow Maps Brandon Lloyd. UNC-CH Naga Govindaraju UNC-CH David Tuft UNC-CH Steve Molnar Nvidia Dinesh Manocha UNC-CH The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Motivation Interactive shadow computation remains a challenge increasing scene complexity large, open environments user expect high quality 2 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Shadow maps Simple two pass algorithm Supports wide range of geometric representations Cheap to render Disadvantage: Aliasing artifacts at shadow edges 3 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Warping algorithms Increase sample density where needed by reparametrizing the shadow map Light-space perspective shadow maps (LSPSMs) [Wimmer et al. 2004] Perspective shadow maps (PSMs) [Stamminger and Drettakis 2002] 4 Trapezoidal shadow maps (TSMs) [Martin and Tan 2004] The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Comparison of parameterizations 4 x 4 projection matrix 5 Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Main results Logarithmic parameterization for directional and point lights Error analysis for point lights Hardware architecture enhancements for logarithmic rasterization 6 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline Related work Aliasing error Logarithmic parameterization Hardware architecture Results 7 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Partitioning algorithms Separate shadow maps for different parts of the scene Includescascaded shadow maps Adaptive shadow maps [Fernando et al. 2001; Lefohn et al. 2006] Plural sunlight buffers [Tadamura et al. 1999, 2001] 8 Tiled shadow maps [Arvo 2004] The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Warping + partitioning 4 x 4 matrix Lixel for every pixel [Chong and Gortler 2004] PSM with cube maps [Kozlov 2004] Warping + various frustum partitioning schemes[Lloyd et al. 2006] Dual paraboloid[Brabec et al. 2002] 9 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Specialized representations Silhouette shadow maps [Sen et al. 2004] Irregular shadow maps [Johnson et al. 2004, 2005; Aila and Laine 2004] Solves the aliasing problem GPU support requires major changes 10 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline Related work Aliasing error Logarithmic parameterization Hardware architecture Results 11 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Aliasing error light shadow plane eye view frustum 12 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Aliasing error w'l light beam w'i w'i image beam w'i 13 w'l The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Aliasing error light beam wl θl image beam wl wi θi wi 14 w'l wl cos θi m= ≈ w cos θ w'i i l w'i w'l cos θi cos θl Perspective aliasing Projection aliasing The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Aliasing error light beam wl θl image beam wl wi θi wi 15 w'l wl cos θi m= ≈ w cos θ w'i i l w'i w'l cos θi cos θl Perspective aliasing Projection aliasing The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Controlling aliasing error To eliminate perspective aliasing: light beam image beam wl wi wl ≤ wi Light beam width depends on: Shadow map resolution Parameterization 16 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline Related work Aliasing error Logarithmic parameterization Directional light Point light Hardware architecture Results 17 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Parameterization light image plane shadow map Standard 18 light shadow map Perspective warped The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Directional light 1. Light beam widths 2. Texel spacing function t 1 light image plane z 3. Parameterization wl [Wimmer et al. 04] 19 image wi beam The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Directional light With 4 x 4 matrix With logarithm beam width Uniform z beam width Quadratic 20 beam width Linear z z The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Shadow maptexels / image texels Comparison 8 10 Standard 6 10 4 Perspective 10 2 10 Logarithmic 0 10 1 10 2 3 10 10 f/n 21 4 10 frustum fov = 60○ The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point lights light view frustum 22 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point lights light image plane y wl ~ z z 23 view frustum face The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point light spacing function - z y ylight 24 z face z The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point light spacing function - z y ylight 25 z face z The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point light spacing function - z y ylight 26 z face z The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Point lights – parameterization 27 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Fitting the spacing function - z Point light spacing function 0 Parameterization for exact function is complicated Fit two parabolas: Parameterization: z 28 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
4 x 4 matrix + logarithm To NDC coords. To screen coordinates vc = P v vn= vc /wc s = a 0 ln( a 1 xn + a 2 ) + a 3 t = b 0 ln( b 1 zn + b 2 ) + b 3 vc : [xc zc yc wc]T - clip coordinate vn : [xn zn yn 1]T - normalized device coordinate v : [x z y 1]T - world coordinate P : perspective or orthographic projection matrix a 0 -a 3 : constants b 0 -b 3 : constants 29 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Parameterization summary Actual spacing functions z: 30 without log with log ortho. x: Point persp. Directional Spacing functions from 4 x 4 matrix + log The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline Related work Aliasing error Logarithmic parameterization Hardware architecture Results 31 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Logarithmic parameterization view frustum Unwarped 32 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Vertex program Transform vertices on the GPU Requires finely tesselated model Increases burden on vertex processor Adaptive tesselation complicated Easier with DX 10 geometry shaders 33 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Fragment program Brute force rasterization Render bounding primitive Transform fragments to original triangle Discard if not inside 10 x slow down Computing bounding primitive is complicated Easier with DX 10 geometry shaders 34 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Graphics pipeline vertex processor clip & back-face cull rasterizer memory interface fragment processor 35 alpha, stencil, & depth tests depth compression blending color compression The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Rasterizing equations Coverage determination use sign of edge distance equations Attribute interpolation depth, color, texture coordinates, etc. 36 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Rasterizing equations Edge distance and attribute interpolation: Parameterization: 37 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Incremental computation 1 MULT + 2 ADD per step 38 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Depth compression First order Second order Compressed tiles shown in red 39 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Feasibility Current hardware trend Computational power increasing rapidly Bandwidth lags behind Log shadow maps Increase computation Reduce memory/bandwidth consumption 40 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Nonlinear rasterization Configurable rasterizer Other rasterization functions are possible Might be useful for other effects Reflections, refractions, caustics, general multi-view perspective [Hou et al. 06] 41 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline Previous work Aliasing error Logarithmic parameterization Hardware implementation Results 42 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results Power plant 13 Mtris 43 Oil tanker 82 Mtris Town scene 59 Ktris The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results Standard 44 Perspective warping Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results Perspective warping 45 Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results Perspective warping 46 Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Shadow map texels / image texels Comparison to z-partitioning 8 10 k=1 Perspective with k z-partitions 6 10 k=2 4 10 k=4 2 10 k=8 Logarithmic 0 10 1 10 2 3 10 10 4 10 f/n 47 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results z-partitioning (k=4) 48 Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results 49 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results Perspective warping 50 Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results Perspective warping 51 Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results – Point lights high error Standard 52 Perspective warping Logarithmic The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Advantages Logarithmic shadow maps require less bandwidth and storage Smoother parameterization than zpartitioning 53 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Disadvantages Does not handle projection aliasing Requires multiple shadow maps Up to 5 directional light Up to 4 per frustum face for point light Warped depth values 54 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conclusion Logarithmic parameterization Lower error than previous methods Hardware architecture for log rasterization Requires only small enhancements to current graphics hardware Exploits current hardware trends 55 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Future work More details for hardware implementation precision requirements filtering shadow map bias Other applications for nonlinear rasterization 56 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Acknowledgements Aaron Lefohn for the town model Supported in part by: NSF Graduate Fellowship ARO Contracts DAAD 19 -02 -1 -0390 and W 911 NF-04 -1 -0088 NSF awards 0400134 and 0118743 ONR Contract N 00014 -01 -1 -0496 DARPA/RDECOM Contract N 61339 -04 -C-0043 Intel 57 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Questions? http: //gamma. cs. unc. edu/logsm 58 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coordinate systems light warping frustum y z x view shadow map zt view frustum s x Light space[Wimmer et al. 04] 59 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Directional light - general case light shadow map t Highest error(wl /wi) occurs at the faces Partition frustum to handle each face separately wl 60 z The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
- Slides: 60