ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 21 February, 2010, Washington, USA Anton Kaplanyan1 1Crytek GmbH Carsten Dachsbacher2 2VISUS / University Stuttgart.
Download ReportTranscript ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 21 February, 2010, Washington, USA Anton Kaplanyan1 1Crytek GmbH Carsten Dachsbacher2 2VISUS / University Stuttgart.
ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 21 February, 2010, Washington, USA Anton Kaplanyan1 1Crytek GmbH Carsten Dachsbacher2 2VISUS / University Stuttgart Motivation ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 2 Previous work Irradiance volumes Greger et al. 1997 SH Irradiance Volumes Tatarchuk 2004 Image-Space Photon Mapping McGuire and Luebke 2009 Multi-resolution Splatting Nichols and Wyman 2009 PRT: Spherical Harmonics Sloan et al. 2004 Spherical proxies with SH Exponentiation Zhong et al. 2007 ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 3 Previous work, continued Instant radiosity Keller 1997 VPL visibility Laine et al. 2007 Ritschel et al. 2008 Many-lights approach Walter et al. 2005 Hasan et al. 2007 Chevlak-Postavak et al. 2008 ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 4 Previous work, continued Disk-based Color Bleeding Bunell 2005 Christensen 2008 Finite Element: Antiradiance Dachsbacher et al. 2007 Microrendering Ritschel et al. 2010 All techniques above have one or more of the following limitations: • Precomputed or redundant data (problems with dynamic and/or editable scenes) • Not suitable for game production performance-wise Most of dynamic techniques are without indirect visibility ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 5 Previous work, lattice methods Light Propagation Maps Fattal 2009 Lattice-Boltzmann Lighting Geist et al. 2004 Lattice-Based Volumetric Global Illumination Qiu et al. 2007 ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 6 Basic idea ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 7 Basic idea ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 8 Basic idea ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 9 Propagation demo Overview Sample lit surface elements Grid initialization Light propagation in the grid Scene illumination with the grid ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 11 Light Propagation Volumes • Use many-lights approach to capture sources of indirect lighting • Sample directly lit surfaces and initialize 3D grid • Represent directional distribution with Spherical Harmonics – Inspired by SH Irradiance Volumes [Tatarchuk04] • Iterative, local propagation: cell-to-cell ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 12 Secondary Light Sources Sample lit surface elements Grid initialization Light propagation in the grid Scene illumination with the grid ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 13 Secondary Light Sources Reflective shadow maps Depth Flux ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington Normal 14 Injection Sample lit surface elements Grid initialization Light propagation in the grid Scene illumination with the grid ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 15 Pipeline Reflective shadow maps Radiance volume gathering VPL VPL VPL A set of regularly sampled VPLs of the scene from light position Discretize initial VPL distribution by the regular grid and SH ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 16 Light injection into the volume • Every element of Reflective Shadow Map is a secondary lights • Render as a point primitive into 3D grid – Represent flux in Spherical Harmonics • Accumulate all VPLs into the grid • The 3D grid is initialized with initial reflected light in the end ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 17 Light Propagation Sample lit surface elements Grid initialization Light propagation in the grid Scene illumination with the grid ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 18 Pipeline Reflective shadow maps Radiance volume gathering Iterative propagation VPL VPL VPL A set of regularly sampled VPLs of the scene from light position Discretize initial VPL distribution by the regular grid and SH ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington Propagate light iteratively going from one cell to another 19 Iterative Light Propagation • Local cell-to-cell propagation across the 3D grid – Iterate till the light travels through the entire volume – Similar to SH Discrete Ordinate Method (used for participating media illumination) – Number of iterations depend on the resolution of the grid ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 20 The propagation iteration • 6 axial directions of propagation • Use contour faces as a propagation wave front • Integrate source intensity by the solid angle to get incoming flux for the face f The propagation iteration • Use more than 6 directions – Only 6 direct neighbors – Compute light propagation to each face of neighbors’ cells – 30 virtual directions – SHDOM: 27 neighbor cells = 27 directions 4 directions of propagation – good trade-off of memory bandwidth vs “ray effect” 8 directions of propagation • “Ray effect” - light propagates in a set of fictitious directions Reprojection • Acquire the incident flux through the receiving face • Create a new point light in the center of receiving cell – Oriented towards the face – Causing exactly the same flux as the face received • Generate clamped cosine lobe in SH basis similar to injection stage • Accumulate the resulting SH coefficients into the destination cell for next iteration Scene rendering Sample lit surface elements Grid initialization Light propagation in the grid Scene illumination with the grid ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 24 Rendering • Look-up grid with trilinear interpolation • Evaluate the irradiance with cosine lobe of surface’s normal • Apply dampening factor – Compute directional derivative towards normal – Dampen based on derivative deviation from the intensity distribution direction ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 25 Results of indirect illumination Cascaded Light Propagation Volumes • Motivation: memory and bandwidth cost is o(N^3) for increase of LPV grid – Impossible to support large scenes • Idea: use multiple nested grids to refine resolution hierarchically – Do not consider small objects for large sparse grids • Transfer propagated lighting from nested grid to the parent grid • Illuminate scene similarly to cascaded shadow maps • Reduces the number of iterations sufficient per cascade ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 27 Cascaded Indirect Illumination 1 cascade 3 cascades ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 28 Fuzzy Secondary Occlusion • Introduce a “fuzzy blocking” between cells • Use another grid for blocking • Occlusion is view-dependent • Projected size of an occluder is a cosine lobe ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 29 Fuzzy Secondary Occlusion Scene • Represent it as SH • Store into occlusion grid • Sample surfaces using rasterization Camera view – Possibly multiple views • Very similar to light injection • Interpolate blocking linearly in between cells ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 30 Fuzzy Secondary Occlusion W/o secondary occlusion With secondary occlusion ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington Multiple Bounces • Idea: use information from occlusion grid to compute multiple indirect reflections • Reflect light during each propagation iteration • Avoid self-illumination by injecting reflected light at safety-distance ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 32 Glossy Reflections • Idea: Compute incident light from reflection direction by marching through LPV grid • Go few steps back in propagation time to reduce light smearing • 4 cells is sufficient for moderately glossy objects • Lookups into multiple cells prevent discontinuities in glossy reflections ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 33 Indirect lighting in isotropic participating media • • • • Ray march through the LPV Accumulate inscattered light Limited to single-scattering Step through the whole grid along view direction – Back to front accumulation ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 34 Timings (Crytek Sponza) Depends on scene complexity Stage GTX 285, ms RSM Rendering 0.16 (256^2) 0.5 (128^2) 0.8 (128^2) VPL Injection 0.05 0.2 0.4 Occlusion Injection 0.02 0.15 0.15 Propagation 0.8/1.1/1.4 0.8/1.1/1.5 0.7/1.1/1.4 LPV look-up 2.4 2.0 1.5 3.4/3.7/4.0 3.5/3.8/4.2 3.4/3.8/4.2 32^3 grid size 8 iterations Depends on image size (1280x720) Total Xbox 360, ms PS 3, ms ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 35 Results Reference, 42 min LPV, 78 fps @GTX285 Reference PBRT, 45 min LPV, 60 fps @GTX285 ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 36 Limitations of the method • Only diffuse inter-reflections • Sparse spatial and low-frequency angular approximations – Light diffusion: light transport smears in all directions – Spatial discretization: visible for occlusion and very coarse grids • Incomplete information for secondary occlusion ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 37 Conclusion • • • • Full-dynamic: scene, view, lighting changes Real-time: GPU- and consoles- friendly Production-eligible (simple tweaking) Highly scalable – proportionally to quality • Stable, flicker-free • Supports complex geometry (e.g. foliage) ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 38 Video ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 39 See the paper for more details We’d like to thank: Crytek and especially the CEO Cevat Yerli for giving us an opportunity to make this research The whole Crytek R&D department and artists for help provided Many people across the industry and research community for interesting discussions and provided feedbacks THANK YOU FOR YOUR ATTENTION ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 40 Backup slide: Small details • Stability of the solution – RSM one-texel snapping – One-cell snapping for LPVs – Temporal SSAA with reprojection for RSM injection • Self-illumination and light bleeding – Half-cell VPL shifting to normal direction during RSM injection – Directional derivative in normal direction to compute a dampening factor ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 41 Backup slide: Console optimizations • For both consoles – Store everything in signed QUVW8 format, [-1;1] with scaling factor – Use h/w 3D textures and trilinear filtering • Xbox 360 – Unwrap RT vertically to avoid bank conflicts during injection – Use API bug work-around to resolve into a 3D slice • PlayStation 3 – Use memory aliasing for render into 3D texture – Use 2x MSAA aliasing to reduce pixel work twice ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games 2010, Washington 42 Backup slide: Console optimizations II • Render Reflective Shadow Map Usually 128 x 128 is ok • Inject each pixel into unwrapped LPV with a swarm of points 16384 points in one DIP Use vertex texture fetch on X360 Use R2VB on PlayStation 3 • Multi-layered unwrapping to avoid bank conflicts during RSM injection on Xbox 360 • All together: 3,0 ms on X360/PS3 Backup slide: Massive Lighting Render sliced unwrapped light box into LPV (spatial overdraw vs screen-space, maximum 1024x32 pixels) Convert light’s radiant intensity into SH Shadows are not supported Light in the Light Propagation Volume Coverage in unwrapped render target