The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Practical Logarithmic Shadow Maps Brandon LloydUNC-CH Naga GovindarajuUNC-CH David TuftUNC-CH Steve MolnarNvidia Dinesh ManochaUNC-CH
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 2 Motivation Interactive shadow computation remains a challenge increasing scene complexity large, open environments user expect high quality
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 3 Shadow maps Simple two pass algorithm Supports wide range of geometric representations Cheap to render Disadvantage: Aliasing artifacts at shadow edges
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 4 Warping algorithms Perspective shadow maps (PSMs) [Stamminger and Drettakis 2002] Increase sample density where needed by reparametrizing the shadow map Trapezoidal shadow maps (TSMs) [Martin and Tan 2004] Light-space perspective shadow maps (LSPSMs) [Wimmer et al. 2004]
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 5 Comparison of parameterizations 4x4 projection matrixLogarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 6 Main results Logarithmic parameterization for directional and point lights Error analysis for point lights Hardware architecture enhancements for logarithmic rasterization
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 7 Outline Related work Aliasing error Logarithmic parameterization Hardware architecture Results
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 8 Partitioning algorithms Separate shadow maps for different parts of the scene Includes cascaded shadow maps Tiled shadow maps [Arvo 2004] Adaptive shadow maps [Fernando et al. 2001; Lefohn et al. 2006] Plural sunlight buffers [Tadamura et al. 1999,2001]
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 9 Warping + partitioning 4x4 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]
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 10 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
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 11 Outline Related work Aliasing error Logarithmic parameterization Hardware architecture Results
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 12 Aliasing error shadow plane view frustum eye light
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 13 light beam 'wlwl 'wiwi 'wiwi 'wiwi 'wiwi Aliasing error 'wlwl image beam
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 14 wiwi wlwl light beam image beam θlθl θiθi 'wiwi Aliasing error 'wlwl m= 'wlwl 'wiwi cos θ l cos θ i wlwl wiwi Perspective aliasing cos θ l cos θ i Projection aliasing wlwl wiwi ≈
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 15 wiwi wlwl θlθl θiθi 'wiwi Aliasing error 'wlwl m= 'wlwl 'wiwi wlwl wiwi Perspective aliasing wlwl wiwi ≈ light beam image beam cos θ l cos θ i cos θ l cos θ i Projection aliasing
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 16 wiwi wlwl light beam image beam Controlling aliasing error To eliminate perspective aliasing: w l ≤ w i Light beam width depends on: Shadow map resolution Parameterization
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 17 Outline Related work Aliasing error Logarithmic parameterization Directional light Point light Hardware architecture Results
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 18 Parameterization Standard Perspective warped light image plane shadow map light
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 19 Directional light image beam light image plane t wlwl light z 1 wiwi 1. Light beam widths 2. Texel spacing function 3. Parameterization [Wimmer et al. 04]
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 20 Quadratic z beam width Uniform z beam width Linear z beam width Directional light With 4x4 matrix With logarithm
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 21 Comparison Standard Perspective Logarithmic frustum fov = 60 ○
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 22 Point lights light view frustum
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 23 Point lights light light image plane view frustum face z y w l ~ z
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 24 Point light spacing function - z face y z z y light
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 25 Point light spacing function - z face y light y z z
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 26 Point light spacing function - z face y light y z z
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 27 Point lights – parameterization
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 28 Fitting the spacing function - z Parameterization for exact function is complicated Fit two parabolas: Parameterization: 0 z Point light spacing function
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 29 4x4 matrix + logarithm v c : [x c z c y c w c ] T - clip coordinate v n : [x n z n y n 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 To screen coordinates s= a 0 ln( a 1 x n + a 2 ) + a 3 t= b 0 ln( b 1 z n + b 2 ) + b 3 To NDC coords. v c = P v v n = v c /w c
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 30 Parameterization summary DirectionalPoint x: z: without logwith log ortho. persp. Actual spacing functions Spacing functions from 4x4 matrix + log
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 31 Outline Related work Aliasing error Logarithmic parameterization Hardware architecture Results
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 32 Logarithmic parameterization Unwarped view frustum
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 33 Vertex program Transform vertices on the GPU Requires finely tesselated model Increases burden on vertex processor Adaptive tesselation complicated Easier with DX10 geometry shaders
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 34 Fragment program Brute force rasterization Render bounding primitive Transform fragments to original triangle Discard if not inside 10x slow down Computing bounding primitive is complicated Easier with DX10 geometry shaders
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 35 Graphics pipeline fragment processor vertex processor rasterizer alpha, stencil, & depth tests blending clip & back-face cull memory interface depth compression color compression
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 36 Rasterizing equations Coverage determination use sign of edge distance equations Attribute interpolation depth, color, texture coordinates, etc.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 37 Rasterizing equations Parameterization: Edge distance and attribute interpolation:
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 38 Incremental computation 1 MULT + 2 ADD per step
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 39 Depth compression First orderSecond order Compressed tiles shown in red
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 40 Feasibility Current hardware trend Computational power increasing rapidly Bandwidth lags behind Log shadow maps Increase computation Reduce memory/bandwidth consumption
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 41 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]
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 42 Outline Previous work Aliasing error Logarithmic parameterization Hardware implementation Results
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 43 Results Power plant 13 Mtris Oil tanker 82 Mtris Town scene 59 Ktris
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 44 Results StandardPerspective warping Logarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 45 Results Perspective warpingLogarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 46 Results Perspective warpingLogarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 47 Comparison to z-partitioning Perspective with k z-partitions Logarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 48 Results z-partitioning (k=4)Logarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 49 Results
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 50 Results Perspective warpingLogarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 51 Results Perspective warpingLogarithmic
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 52 Results – Point lights StandardPerspective warping Logarithmic high error
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 53 Advantages Logarithmic shadow maps require less bandwidth and storage Smoother parameterization than z-partitioning
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 54 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
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 55 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
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 56 Future work More details for hardware implementation precision requirements filtering shadow map bias Other applications for nonlinear rasterization
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 57 Acknowledgements Aaron Lefohn for the town model Supported in part by: NSF Graduate Fellowship ARO Contracts DAAD and W911NF NSF awards and ONR Contract N DARPA/RDECOM Contract N C-0043 Intel
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 58 Questions?
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 59 Coordinate systems view y z x warping frustum view frustum light shadow map t s Light space [Wimmer et al. 04] z x
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL 60 Directional light - general case Highest error ( w l /w i ) occurs at the faces Partition frustum to handle each face separately wlwl light shadow map t z