Multi-View Soft Shadows. Louis Bavoil

Similar documents
Constant-Memory Order-Independent Transparency Techniques

Horizon-Based Ambient Occlusion using Compute Shaders. Louis Bavoil

Order Independent Transparency with Dual Depth Peeling. Louis Bavoil, Kevin Myers

User Guide. Vertex Texture Fetch Water

SDK White Paper. Soft Shadows

SDK White Paper. Vertex Lighting Achieving fast lighting results

Deinterleaved Texturing for Cache-Efficient Interleaved Sampling. Louis Bavoil

Technical Report. Anisotropic Lighting using HLSL

SDK White Paper. Matrix Palette Skinning An Example

Soft Particles. Tristan Lorach

White Paper. Soft Shadows. February 2007 WP _v01

Whitepaper. Integrating Realistic Soft Shadows into Your Game Engine. Kevin Myers Randima (Randy) Fernando Louis Bavoil

White Paper. Solid Wireframe. February 2007 WP _v01

Technical Report. GLSL Pseudo-Instancing

SDK White Paper. HLSL Blood Shader Gravity Maps

Android PerfHUD ES quick start guide

SDK White Paper. Occlusion Query Checking for Hidden Pixels

Sparkling Effect. February 2007 WP _v01

User Guide. GPGPU Disease

NVIDIA nforce 790i SLI Chipsets

Tuning CUDA Applications for Fermi. Version 1.2

GPU LIBRARY ADVISOR. DA _v8.0 September Application Note

CUDA Particles. Simon Green

Technical Brief. NVIDIA Quadro FX Rotated Grid Full-Scene Antialiasing (RG FSAA)

Technical Brief. LinkBoost Technology Faster Clocks Out-of-the-Box. May 2006 TB _v01

Application Note. NVIDIA Business Platform System Builder Certification Guide. September 2005 DA _v01

GLExpert NVIDIA Performance Toolkit

White Paper. Texture Arrays Terrain Rendering. February 2007 WP _v01

Technical Brief. NVIDIA and Microsoft Windows Vista Getting the Most Out Of Microsoft Windows Vista

User Guide. GLExpert NVIDIA Performance Toolkit

CUDA/OpenGL Fluid Simulation. Nolan Goodnight

User Guide. DU _v01f January 2004

Volumetric Particle Shadows. Simon Green

Skinned Instancing. Bryan Dudash

High Quality DXT Compression using OpenCL for CUDA. Ignacio Castaño

Technical Brief. AGP 8X Evolving the Graphics Interface

Technical Report. Non-Power-of-Two Mipmap Creation

Optical Flow Estimation with CUDA. Mikhail Smirnov

Real-time Shadow Mapping

NVWMI VERSION 2.18 STANDALONE PACKAGE

User Guide. TexturePerformancePBO Demo

White Paper. Perlin Fire. February 2007 WP _v01

Cg Toolkit. Cg 2.1 October 2008 Release Notes

NVWMI VERSION 2.24 STANDALONE PACKAGE

White Paper. Denoising. February 2007 WP _v01

Cg Toolkit. Cg 2.1 beta August 2008 Release Notes

Enthusiast System Architecture Certification Feature Requirements

Technical Report. Mesh Instancing

NVIDIA CAPTURE SDK 6.1 (WINDOWS)

Rain. Sarah Tariq

Technical Report. SLI Best Practices

GRID SOFTWARE FOR RED HAT ENTERPRISE LINUX WITH KVM VERSION /370.28

NVIDIA CAPTURE SDK 6.0 (WINDOWS)

Cg Toolkit. Cg 2.2 April 2009 Release Notes

NVIDIA SDK. NVMeshMender Code Sample User Guide

Cg Toolkit. Cg 2.0 January 2008 Release Notes

SDK White Paper. Video Filtering on the GPU. Eric Young NVIDIA Corporation 2701 San Tomas Expressway Santa Clara, CA 95050

Using Perception-Based Filtering to Hide Shadow Artifacts

Cg Toolkit. Cg 1.2 Release Notes

Advanced Shading I: Shadow Rasterization Techniques

Cg Toolkit. Cg 2.0 May 2008 Release Notes

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Computergrafik. Matthias Zwicker. Herbst 2010

QUADRO SYNC II FIRMWARE VERSION 2.02

Thesis Report. Thesis Title: Soft Shadow Rendering in Real Time. Shihab Rezwan Manzur ID: CSE Department BRAC University

CUDA TOOLKIT 3.2 READINESS FOR CUDA APPLICATIONS

Cg Toolkit. Cg 1.3 Release Notes. December 2004

CUDA Particles. Simon Green

Technical Report. SLI Best Practices

Histogram calculation in CUDA. Victor Podlozhnyuk

NSIGHT ECLIPSE PLUGINS INSTALLATION GUIDE

GRID SOFTWARE FOR MICROSOFT WINDOWS SERVER VERSION /370.12

Computer Graphics. Shadows

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

Histogram calculation in OpenCL. Victor Podlozhnyuk

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Computer Graphics 10 - Shadows

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

NVIDIA CAPTURE SDK 7.1 (WINDOWS)

Shadow Rendering EDA101 Advanced Shading and Rendering

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

MOSAIC CONTROL DISPLAYS

Advanced Shading and Texturing

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Particle Simulation using CUDA. Simon Green

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Cg Toolkit. Cg 2.2 February 2010 Release Notes

Adaptive Depth Bias for Soft Shadows

Real-Time Hair Rendering on the GPU NVIDIA

TUNING CUDA APPLICATIONS FOR MAXWELL

User Guide. Melody 1.2 Normal Map Creation & Multiple LOD Generation

Variable Penumbra Soft Shadows for Mobile Devices

TUNING CUDA APPLICATIONS FOR MAXWELL

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

Programming Graphics Hardware

SDK White Paper. Improve Batching Using Texture Atlases

NSIGHT ECLIPSE EDITION

Shadows. COMP 575/770 Spring 2013

Computer Graphics Shadow Algorithms

Transcription:

Multi-View Soft Shadows Louis Bavoil lbavoil@nvidia.com

Document Change History Version Date Responsible Reason for Change 1.0 March 16, 2011 Louis Bavoil Initial release

Overview The Multi-View Soft Shadows (MVSS) algorithm renders contact-hardening shadows by averaging hard shadows from multiple point lights evenly distributed on an area light. This is similar to accumulation-buffer rendering [Haeberli and Akeley 90], the main difference being that with MVSS the scene is rendered a single time from the eye s point of view. First, the scene geometry is rasterized into multiple shadow maps with one shadow map per point light. Second, soft shadows are rendered by averaging the hard shadows from each shadow map in a pixel shader. In this DirectX 11 code sample, the shadow maps are implemented as a depth texture array, they are generated with one depth-only pass per shadow map, and they are fetched with one bilinear hardware-pcf sample per shadow map. Figure 1. Multi-View Soft Shadows (MVSS) with 28 shadow maps. Rendered in 2.7 ms in 1920x1200 4xMSAA on GeForce GTX 580. NVIDIA Corporation 2701 San Tomas Expressway Santa Clara, CA 95050 www.nvidia.com

Introduction The purpose of the Multi-View Soft Shadows algorithm is to render realistic contacthardening soft shadows in real time. Contact-hardening soft shadows are particularly important for realistic rendering because the human visual system uses the variations of penumbra size as a cue for evaluating distances between shadow-casting and shadowreceiving objects [Fernando 05] [Myers et al. 08]. Among the vast literature of soft-shadow rendering algorithms (see [Eisemann et al. 09] for a recent survey), two of them are commonly used for generating ground-truth images: distributed ray tracing [Cook et al. 84] and accumulation-buffer rendering [Haeberli and Akeley 90]. Multi-View Soft Shadows takes the latter approach, sampling the area light with point lights and using one shadow map per point-light sample. Percentage Closer Filtering (PCF) [Reeves et al. 87] is a popular algorithm for rendering dynamic shadows in games. Shadows rendered with PCF can be made softer by increasing the footprint of the PCF kernel but they do not harden on contact. The Percentage-Closer Soft Shadows (PCSS) algorithm [Fernando 05] is an extension of PCF which can render physically-plausible contact-hardening shadows. Like PCSS, Multi-View Soft Shadows (MVSS) uses a depth bias to avoid self-shadowing artifacts (surface acne), by pushing the shadow-map fragments away from the light source. For PCF kernels, the larger is the kernel, the larger the depth bias must be to avoid surface acne. Since MVSS uses a smaller PCF kernel than PCSS (2x2 for MVSS, dynamic size for PCSS), MVSS can use a smaller depth bias without introducing artifacts, which makes it more robust with regard to self-shadowing. Implementation Shadow-Map Passes In this SDK sample, the light source is a disk and point-light samples are distributed over the area of the light by using a Poisson-disk sampling pattern [Bridson 07]. The shadow maps are implemented as a depth texture array with one slice per shadow map. Before drawing into it, the depth texture array is cleared at once by performing a hardware Clear on a depth-stencil view encompassing the entire texture array. For each point-light sample, the depth-stencil view is set to the corresponding slice in the depth texture array, and the hardware depths of the shadow-casting geometry are rendered into the current shadow map. To avoid surface acne, the hardware depth bias is enabled and both a constant depth bias and a slope-scaled depth bias are used.

Shading Pass For each shaded fragment, the 3D position of the fragment needs to be projected onto each shadow map (4x4 matrix multiply followed by a perspective division), and the shadow contributions from each shadow map need to be computed and averaged together. The vertex shader performs the 4x4 matrix multiply for each point light, and the resulting (u,v,z,w) coordinates (one float4 per shadow map) are passed down to the pixel shader as interpolated attributes with perspective-correct interpolation. Performance Table 1 presents a performance analysis of this SDK sample, for scenes with 2 shadowcasting characters (12,086 triangles) and 6 shadow-casting characters (36,258 triangles), using 28 512 2 shadow maps. In these results, the performance is limited mainly by the shadowmap filtering pass, not by the shadow-map generation passes. Increasing the shadow-map resolution from 512 2 to 1024 2 may cause a 1-10% performance hit on the shadow-map generation and a 1-2% hit on the shadow-map filtering, assuming that all the shadow maps fit in video memory (28 MB for 28 512 2 32-bit shadow maps). Table 1. Performance in 1920x1200 1xMSAA on GeForce GTX 580. GPU Time 12,086 Triangles 36,258 Triangles Shadow-Map Generation 0.3 ms (14%) 0.9 ms (27%) Forward Rendering 1.9 ms (86%) 2.4 ms (73%) Total 2.2 ms 3.3 ms Code Organization In MultiViewSoftShadows.h, Scene::Render() is the main rendering method, which renders the shadow maps and performs the shading pass. MultiViewSoftShadows.cpp contains the code for the GUI and DXUT callbacks. The HLSL source code of the shaders is located in the shaders subdirectory.

Running the Sample The left button controls the light position and the right button the camera position. The mouse wheel zooms in and out. The light source is a disk area light. The Light Size slider changes the radius of the light. The Visualize Depth check box outputs the shadow-map depths on the screen. The visualized depths are the one from the last-rendered shadow map. In the GUI, the sample displays the GPU time spent generating the 28 shadow maps, and performing the shading pass, as well as the number of shadow-casting triangles rendered in each shadow map, and the total amount of allocated video memory for the shadow maps. Conclusion With previous-generation GPUs, rendering the geometry of the shadow-casting objects multiple times was typically impractical for games. With NVIDIA s Fermi GPUs, Multi- View Soft Shadows (MVSS) have become more practical for casting realistic contacthardening soft shadows from a limited number of triangles, such as in-game characters. References [Eisemann et al. 09] E. Eisemann, U. Assarsson, M. Schwarz, M. Wimmer, Casting Shadows in Real Time, ACM SIGGRAPH ASIA 2009 Courses, 2009. [Myers et al. 08] K. Myers, R. Fernando, L. Bavoil, "Integrating Realistic Soft Shadows into Your Game Engine", NVIDIA Whitepaper, 2008. [Bridson 07] R. Bridson, Fast Poisson disk sampling in arbitrary dimensions, ACM SIGGRAPH 2007 Sketch Program, 2007. [Fernando 05] R. Fernando, Percentage-Closer Soft Shadows, ACM SIGGRAPH Sketch Program, 2005. [Haeberli and Akeley 90] P. Haeberli, K. Akeley, The Accumulation Buffer: Hardware Support for High-Quality Rendering, Proceedings of ACM SIGGRAPH, 1990. [Reeves et al. 87] W. Reeves, D. Salesin, R. Cook, Rendering Antialiased Shadows with Depth Maps, Proceedings of ACM SIGGRAPH, 1987. [Cook et al. 84] R. Cook, T. Porter, L. Carpenter, Distributed ray tracing, Proceedings of ACM SIGGRAPH, 1984.

Notice ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY, MATERIALS ) ARE BEING PROVIDED AS IS. NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. Information furnished is believed to be accurate and reliable. However, NVIDIA Corporation assumes no responsibility for the consequences of use of such information or for any infringement of patents or other rights of third parties that may result from its use. No license is granted by implication or otherwise under any patent or patent rights of NVIDIA Corporation. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. NVIDIA Corporation products are not authorized for use as critical components in life support devices or systems without express written approval of NVIDIA Corporation. Trademarks NVIDIA, the NVIDIA logo, GeForce, NVIDIA Quadro, and NVIDIA CUDA are trademarks or registered trademarks of NVIDIA Corporation in the United States and other countries. Other company and product names may be trademarks of the respective companies with which they are associated. Copyright 2011 NVIDIA Corporation. All rights reserved.