Hard Shadows Aliasing and Remedies

Similar documents
FRUSTUM-TRACED RASTER SHADOWS: REVISITING IRREGULAR Z-BUFFERS

FRUSTUM-TRACED RASTER SHADOWS: REVISITING IRREGULAR Z-BUFFERS

Here s the general problem we want to solve efficiently: Given a light and a set of pixels in view space, resolve occlusion between each pixel and

Pixel Accurate Shadows with Shadow Mapping

A Survey of Real-Time Hard Shadow Mapping Methods

Michael Wimmer, Daniel Scherzer and Werner Purgathofer. Presentation by: Nikolas Rodarakis, Stavros Tsikinas

What for? Shadows tell us about the relative locations. Vienna University of Technology 2

Fast, Sub-pixel Antialiased Shadow Maps

Sub-Pixel Shadow Mapping

Practical Shadow Mapping

Logarithmic Perspective Shadow Maps

Perspective Shadow Maps. Shadow Map Aliasing. in particular for large scenes shadow maps impossible for infinite scenes

EFFICIENT HIGH-QUALITY SHADOW MAPPING

Lecture 9: Deferred Shading. Visual Computing Systems CMU , Fall 2013

Computer Graphics Shadow Algorithms

High-quality Shadows with Improved Paraboloid Mapping

HIGH-QUALITY RASTERIZATION CHRIS WYMAN SENIOR RESEARCH SCIENTIST, NVIDIA

Shadow geometry maps for alias-free shadows

Robust Shadow Maps for Large Environments

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Real-time Shadows in CG

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Hello, Thanks for the introduction

Computergrafik. Matthias Zwicker. Herbst 2010

Perspective Projection and Texture Mapping

CHAPTER 3. Visualization of Vector Data. 3.1 Motivation

Separating Plane Perspective Shadow Mapping

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

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Rasterization Overview

Shadows for Many Lights sounds like it might mean something, but In fact it can mean very different things, that require very different solutions.

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Soft Shadows. Michael Schwarz

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Specialized Acceleration Structures for Ray-Tracing. Warren Hunt

Pipeline Operations. CS 4620 Lecture 10

Shadow Caster Culling for Efficient Shadow Mapping

Lecture 13: Reyes Architecture and Implementation. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

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

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

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Visibility and Occlusion Culling

Shadows. Real-Time Hard Shadows. Collected by Ronen Gvili. Most slides were taken from : Fredu Durand Stefan Brabec

Practical Shadows. Outline

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

Acknowledgement: Images and many slides from presentations by Mark J. Kilgard and other Nvidia folks, from slides on developer.nvidia.

Projection and viewing. Computer Graphics CSE 167 Lecture 4

Many rendering scenarios, such as battle scenes or urban environments, require rendering of large numbers of autonomous characters.

Advanced Ray Tracing

Theory to Practice: Generalized Minimum-Norm Perspective Shadow Maps for Anti-aliased Shadow Rendering in 3D Computer Games

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

LOGARITHMIC PERSPECTIVE SHADOW MAPS. D. Brandon Lloyd

Real-Time Shadows. Computer Graphics. MIT EECS Durand 1

EECS 487: Interactive Computer Graphics

WHILE conceptually simple, rendering artifact-free, antialiased

3D Rasterization II COS 426

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CC Shadow Volumes. Abstract. Introduction

My focus will be on pointing out the patterns rather than explaining individual algorithms

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

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

Comparison of hierarchies for occlusion culling based on occlusion queries

Morphological: Sub-pixel Morhpological Anti-Aliasing [Jimenez 11] Fast AproXimatte Anti Aliasing [Lottes 09]

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

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

Shadow Rendering EDA101 Advanced Shading and Rendering

Shadow Mapping. Marc Stamminger, University of Erlangen-Nuremberg

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

Point Cloud Filtering using Ray Casting by Eric Jensen 2012 The Basic Methodology

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Image Precision Silhouette Edges

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

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

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Using Perception-Based Filtering to Hide Shadow Artifacts

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

Computer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Overview. A real-time shadow approach for an Augmented Reality application using shadow volumes. Augmented Reality.

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

Projection Matrix Tricks. Eric Lengyel

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Visibility. Welcome!

REYES REYES REYES. Goals of REYES. REYES Design Principles

Pipeline Operations. CS 4620 Lecture 14

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Universiteit Leiden Computer Science

Simpler Soft Shadow Mapping Lee Salzman September 20, 2007

Game Architecture. 2/19/16: Rasterization

Transcription:

Hard Shadows Aliasing and Remedies Michael Wimmer www.realtimeshadows.com

Shadow Map as Signal Reconstruction Initial sampling: shadow-map rendering Resampling: determined by view Reconstruction: nearest neighbor, PCF, shadow map (regular grid) polygons shadowed fragments

Main Types of Error Initial sampling: Undersampling Resampling: Oversampling Reconstruction: Reconstruction error (with undersampling) 25 sample Poisson PCF nearest neighbor

Main Types of Error Undersampling No bandlimiting (e.g., super-sampled shadow map, possible!) Improve initial sampling! Oversampling Use bandlimiting filters in reconstruction (VSM, CSM, later) Reconstruction error Use better reconstruction filters (PCF, ) Main topic for next 30 minutes! Use different reconstruction algorithm (Silhouette Shadow Maps)

Overview Improving Initial Sampling/Undersampling Fitting (Focusing) Error Analysis Warping Partitioning Irregular Sampling Temporal Coherence Better reconstruction

Hard Shadows Fighting Undersampling - Fitting

Fitting: Focus the Shadow Map [Brabec et al. 2002] Only include relevant objects Intersection body determined by: Shadow casters Light source frustum View frustum

Fitting: Focus the Shadow Map Unfocused Focused

Fitting Calculation Model matrix M, light view matrix Lv, light proj. matrix Lp Transform intersection body by Lp Lv Calculate bounds (xmin,ymin,xmax,ymax) Calculate fitting matrix F ( viewport transform ): Shadow matrix: S = F Lp Lv M

Fitting: Temporal Aliasing

Fitting: Temporal Aliasing Solutions: Increase initial sampling frequency Make fitting adhere to texel boundaries: Adjust fitting matrix F: r: half shadow-map resolution o: ox/oy Will not work for warping

Hard Shadows Error Analysis

Initial Sampling - Perspective Aliasing Sufficient resolution far from the observer Insufficient resolution near the observer okay aliased

Initial Sampling - Projection Aliasing Shadow receiver ~ orthogonal to shadow map 17

(Simple) Initial Sampling Error Analysis Aliasing error: Parameterization Perspective Projection ds eye z n dp z β α dz

Hard Shadows Fighting Undersampling Warping

Solution for Perspective Aliasing Insufficient resolution near eye okay aliased

Solution for Perspective Aliasing Insufficient resolution near eye Redistribute values in shadow map

Solution for Perspective Aliasing Sufficient resolution near eye Redistribute values in shadow map still okay okay now

Shadow Map Warping Use an additional perspective frustum Perspective Shadow Maps (PSM) [Stamminger & Drettakis 2002] uniform shadow map warped scene warped shadow map

PSM: Warping Frustum = View Frustum! Shadows from behind world space post-perspective space

PSM: Warping Frustum = View Frustum! Light changes type

world space post-perspective space PSM: Warping Frustum = View Frustum! Most severe: uneven z-distribution Good near viewer, very bad far away! Can be reduced by pushing near plane away

PSM Problems? Enter Light-Space Perspective Shadow Maps (LiSPSM) [Wimmer et al. 2004] Perspective frustum defined relative to light space Optimize warping strength to improve z-distribution Similar to Trapezoidal Shadow Maps (TSM) [Martin & Tan 2004]

Light-Space Perspective Shadow Mapping (LiSPSM) Light and view vector define yz-plane y light z x view

Light-Space Perspective Shadow Mapping (LiSPSM) Find a tight perspective frustum on focused region In light space! y light x z

Free Parameter n Controls warping effect n n z n n = z n : PSM n infinity : uniform shadow maps

Free Parameter n very big n optimal n? very small n

LiSPSM Matrix Standard light matrix: S = F Lp Lv M Orient shadow map along view vector: R Transform intersection body by R Lp Lv Find near/far, and choose warping strength n Calculate warping matrix: Wp Wv Calculate F using Wp Wv R Lp Lv Warped shadow matrix Sw = F Wp Wv R Lp Lv M Use Sw both for shadow-map generation and rendering

How to Choose the Free Parameter n? Recall error analysis > 1 shadow map undersampling Projection aliasing cannot be changed Counter perspective aliasing with new shadow map parameterization s(z, ) Goal: ~ 1

Error Analysis Perfect: logarithmic re-parameterization Hardware support? [Lloyd 2007, 2008] Uniform shadow maps Perspective shadow maps Linear increase in error!

Error Analysis: LiSPSM Optimal Choice For LiSPSM, Gives dp ds dp ds Optimal choice: depends on n between uniform and perspective n

Error Comparison LiSPSM optimal choice Measured along view dir LiSPSM vs PSM for same depth range, LiSPSM error much lower z near z far

Comparison Uniform LiSPSM PSM

t ~ x Error Comparison Caveat: only measured along view direction dp dt What about? s ~ z dp dt ~ 1 for PSM, slightly worse for LiSPSM More advanced analysis was done in [Lloyd 2006] Result: storage factor constant for n in [z n, n opt ] But: best error distribution for nopt

Warping: Problems Only works if large z-range visible from light Dueling frusta case 40

Hard Shadows Fighting Undersampling Partitioning

Z-Partitioning: Idea Parallel Split Shadow Maps [Zhang 2007] Cascaded Shadow Maps [Engel 2007][Zhang2009] z x

Z-Partitioning Partition view frustum into n sub-frusta Calculate separate shadow map for each x z

Z-Partitioning Works even in cases where warping fails Light from behind, dueling frusta

Z-Partitioning How to choose partition sizes? Uniform Logarithmic/self-similar Linear blend between the two

Z-Partitioning Sample Distribution Maps [Lauritzen et al. 2011] Optimal partition: logarithmic Problem: empty areas Depth histogram Solution: scene analysis Get min/max-z Adjust depth bounds

Z-Partitioning Sample Distribution Maps [Lauritzen et al. 2011] Extension: analyze fragment distribution in light space Tightly fit partitions in s and t Shadow map Standard Z-partitions Bounded partitions

Shadow Caster Culling [Mattausch et al. 2011] How to determine relevant fragments in light space? Determine shadow receivers (camera pass) Render shadow receivers into light-space mask (light pass) Fragment-level check using reverse shadow lookup visible fragments

Shadow Caster Culling [Mattausch et al. 2011] Culling: Use mask for occlusion culling for depth map Large performance gain for outdoor scenes!

Z-Partitioning and Warping x z

Z-Partitioning and Warping Partitioning Partitioning + warping

Temporal coherence Fix coordinate system orientation in world space Shadow maps move at integral multiples of a texel width (see fitting) Gives up warping

Face Partitioning [Lloyd et al. 2006] Alternative to z-partitioning Partition frustum according to faces Can be combined with z-partitioning (see later) Reduces redundancy Also works without warping ( oblique projection ) view frustum from behind face partitioning + z-partitioning

Full Error Analysis [Lloyd et al. 2006]

Adaptive Partitioning Warping and z-partitioning are global resampling schemes Deal with perspective aliasing Projection aliasing needs local scene adaptive resampling! Adaptive partitioning adaptively splits shadow map Usually quad-tree subdivision Algorithms mainly differ in termination criteria 57

Adaptive Shadow Maps [Fernando et al. 2001; Lefohn et al. 2006] High resolution only needed at edges Search for edge (slow) If edge split 58

Fitted Virtual Shadow Maps/Resolution Matched SM [Giegl & Wimmer 2007], [Lefohn et al. 2007] Do not calculate all quad-tree levels, but determine finest levels necessary Camera prepass Analyzed on CPU (FVSM) or GPU (RMSM)

Fitted Virtual Shadow Maps [Giegl & Wimmer 2007]

Rectilinear Warping [Rosen et al. 2012] Apply 2 separate 1D-warps based on scene content

Rectilinear Warping [Rosen et al. 2012] Requires scene analysis pass Requires tessellation to create shadow map Standard shadow map Rectilinearly warped shadow map

Hard Shadows Fighting Undersampling Irregular Sampling

Shadow Mapping Sampling

What Samples Do We Want? Idea: use eye space samples to generate shadow map samples

Alias Free Hard Shadows [Aila and Laine 2004][Sintorn et al. 2008] Camera pass: transform and project view-samples into light-space Store in a compact data structure with a list per light-space texel screen space shadow map

Alias Free Hard Shadows [Sintorn et al. 2008] Light pass: render all geometry (conservatively) For each generated fragment, test all view-samples in list against triangle Set corresponding output bit depending on occlusion

Alias Free Hard Shadows [Sintorn et al. 2008] Final screen-space pass Use bitmask from previous pass for shadowing

Subpixel Alias Free Shadow Maps [Zhou et al. 2009] Problem: no antialiasing (supersampling) Solution: Project facets instead of samples Precompute subsample tests (constant time [Eisemann 2007])

cache(n):= conf s(n) + (1 conf ) cache(n 1) Hard Shadows Temporal Reprojection

Temporal Smoothing Shadowing result of previous frame (n 1) is stored in cache cache

Temporal Smoothing Shadowing result of previous frame (n 1) is stored in cache Current frame (n): cache(n) := w s(n) + (1 w) cache(n 1)

Weight? Confidence Estimation! eye sample Shadow map test probably more correct closer to texel center Confidence: conf := 1- dist(eye,texel) Greater confidence greater impact

Confidence and Temporal Smoothing Confidence is weight for temporal smoothing cache(n):= conf s(n) + (1 conf ) cache(n 1) 78

Hard Shadows Better Reconstruction

Shadow Silhouette Maps [Sen et al. 2003] Use a better silhouette approximation Store additional information of shadow edge

Shadow Silhouette Maps [Sen et al. 2003] 1. Create shadow map 2. Find silhouette edges 3. Rasterize silhouettes a. Find points that lie on silhouette edges b. Store such points into silhouette map 4. Compute shadows a. Non-silhouette pixels use standard shadow map b. Silhouette pixels use silhouette map

Shadow Silhouette Maps [Sen et al. 2003] Fragment Silhouette points 1 interior + 4 external Create quadrants Shade fragment according to shadow test result at corner point

Shadow Silhouette Maps [Sen et al. 2003] shadow map silhouette map

Hard Shadows Conclusion

Conclusions www.realtimeshadows.com Fastest speed, single shadow map: warping Good for outdoor Fast speed, better quality, >1 shadow maps: z-partitioning (+warping) Add lightweight scene analysis to tightly bound partitions and cull shadow casters High quality, lower speed: adaptive partitioning Reference quality, even slower: irregular sampling Combine with subpixel sampling