EECS 487: Interactive Computer Graphics

Similar documents
Computer Graphics Shadow Algorithms

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

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

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

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

Shadows. COMP 575/770 Spring 2013

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

Shadow Mapping. Marc Stamminger, University of Erlangen-Nuremberg

Screen Space Ambient Occlusion. Daniel Kvarfordt & Benjamin Lillandt

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

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

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

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

Shadows. Shadows. Spatial relationship between objects. Shadows as depth cue. Spatial relationship between objects

TSBK03 Screen-Space Ambient Occlusion

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

Texture Mapping II. Light maps Environment Maps Projective Textures Bump Maps Displacement Maps Solid Textures Mipmaps Shadows 1. 7.

Shadows. Shadows. Spatial relationship between objects. Shadows as depth cue. Spatial relationship between objects

Lecture 17: Shadows. Projects. Why Shadows? Shadows. Using the Shadow Map. Shadow Maps. Proposals due today. I will mail out comments

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

Enhancing Traditional Rasterization Graphics with Ray Tracing. March 2015

Pipeline Operations. CS 4620 Lecture 14

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

Computergrafik. Matthias Zwicker. Herbst 2010

Rasterization Overview

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Shadows. Shadows. Thanks to: Frédo Durand and Seth Teller MIT. Realism Depth cue

Pipeline Operations. CS 4620 Lecture 10

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

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

Computer Graphics Lecture 11

Shadow Rendering EDA101 Advanced Shading and Rendering

Shadow Techniques. Sim Dietrich NVIDIA Corporation

lecture 19 Shadows - ray tracing - shadow mapping - ambient occlusion Interreflections

Computer Graphics. Shadows

Ambient Occlusion. Ambient Occlusion (AO) "shadowing of ambient light "darkening of the ambient shading contribution

Soft Shadows: Heckbert & Herf. Soft shadows. Heckbert & Herf Soft Shadows. Cornell University CS 569: Interactive Computer Graphics.

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

CS354R: Computer Game Technology

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

RASTERISED RENDERING

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Shadows in the graphics pipeline

Deferred Rendering Due: Wednesday November 15 at 10pm

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Practical Shadow Mapping

Computer Graphics 10 - Shadows

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

Advanced Shading I: Shadow Rasterization Techniques

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

Recall: Indexing into Cube Map

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

CS451Real-time Rendering Pipeline

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

Topics and things to know about them:

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Creating soft shadows

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

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

Screen Space Ambient Occlusion TSBK03: Advanced Game Programming

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

The Traditional Graphics Pipeline

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

An Image-space Approach to Interactive Point Cloud Rendering Including Shadows and Transparency

Computer Graphics. Bing-Yu Chen National Taiwan University

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

Models and Architectures

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

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

Applications of Explicit Early-Z Culling

Real-Time Voxelization for Global Illumination

Image Based Lighting with Near Light Sources

Image Based Lighting with Near Light Sources

Advanced Computer Graphics CS 563: Screen Space GI Techniques: Real Time

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Shadow and Environment Maps

Dynamic Ambient Occlusion and Indirect Lighting. Michael Bunnell NVIDIA Corporation

MIT Monte-Carlo Ray Tracing. MIT EECS 6.837, Cutler and Durand 1

Introduction to Visualization and Computer Graphics

Global Illumination. COMP 575/770 Spring 2013

Local vs. Global Illumination & Radiosity

Homework #2. Shading, Ray Tracing, and Texture Mapping

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

Reflection and Shading

Advanced Ray Tracing

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Advanced Graphics. Global Illumination. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

VAO++: Practical Volumetric Ambient Occlusion for Games

Transcription:

Shadow Mapping EECS 487: Interactive Computer Graphics Lecture 32: Interactive Visual Effects Shadow Map Ambient Occlusion A point is lit if it is visible from the light source similar to visible surface determination Shadow computation by simulating eye at light position Durand Shadow Mapping Requires 2 passes through the pipeline First pass: compute shadow map (depth of closest pixels to the light) render scene from light populate z-buffer that we ll use as our shadow map store the distance from light to nearest object white is far, black is near shadow map scene from light s point of view depth value Shadow Mapping Second pass: shadow determination using the shadow map For each pixel do normal z-buffer computation to check visibility from eye if visible, look up distance to light perspective project visible pixels from eye space back to light space lookup depth stored in shadow map if distance to light is (epsilon) greater than stored depth, pixel is in shadow scene from eye s point of view Foley et al., Akenine-Möller02,Durand Foley et al., Akenine-Möller02,Durand

Shadow Mapping with OpenGL Create the shadow map: render the scene with eye at light position save the resulting z-buffer and projection matrix, these are the shadow map and shadow projection matrix glreadpixels( ) to read back z-buffer glgetdoublev(gl_modelview_matrix, ), glgetdoublev(gl_projection_matrix, ), glgetintergerv(gl_viewport, ) Render scene: render the scene from the actual viewpoint save both color and z-buffers and viewpoint projection matrix Shadow Mapping with OpenGL Determine eye-space, light-space correspondences: unproject every pixel in the z-buffer to obtain object coordinates, using gluunproject( ) and the viewpoint projection matrix project the object coordinates into the shadow map using gluproject( ) and the shadow projection matrix Shadow rendering: compare the resulting z values with the corresponding content of the shadow map and update the color buffer to draw the projected shadows write back the modified color buffer using gldrawpixels( ) Yu Yu Limitations of Shadow Maps 1. Limited field of view, no omni-directional light 2. Limited depth resolution 3. Shadow map aliasing 4. Hard shadows only (with jaggies) (or soft shadows only if PCF is used) Limited Field of View What if a point/ is outside field of view of the shadow map? Use six shadow maps, to form a cube enclosing the light requires a separate rendering pass for each shadow map! Durand Durand

Limited Depth Resolution Due to z-fighting, distance to light and stored depth may not compare correctly add an ε to depth in shadow map to prevent unintended (self-)shadowing in computing shadow map move geometry away from light by a small amount choosing correct ε value is tricky Precision error also possible with projection shadows ε precision error Shadow Map Aliasing Results from sampling rates mismatch (re-sampling problem): sampling rate (pixel size) of light is mismatched to that of the eye Merrell Kilgard Shadow Map Aliasing Least aliasing when light frustum is reasonably well aligned with the eye s view frustum: the ratio of sample sizes is close to 1 best case if eye and light frusta are nearly identical ( miner s lamp case) but only limited scene setups satisfy this worst case is when light is shining at the viewer ( deer-in-the-headlights case) also known as the dueling frusta problem Shadow Map Aliasing Shadow fragment is also stretched when eye is close to the surface but light is far away surfaces that are nearly edge-on to the eye face the light directly results in under-sampling of near field in shadow map reference image projected fragment Kilgard Durand,Merrell,RTR3 standard shadow map

Shadow Map Anti-Aliasing Possible solutions: 1. increase shadow map resolution 2. split shadow map into several slices Shadow Map Anti-Aliasing Asymmetric frustrum for shadow map rendering 3. use asymmetric frustrum for shadow map rendering 4. average nearby pixels different projections, same resolution Durand,RTR3 RTR3,Martin&Tan Percentage-Closer Filtering depth values If so, occludes surface Results in aliased shadow Anti-aliasing by averaging several nearby shadow map fragments What to average? Depth values? No, 1.2 < 49.8, but so is 22.9: still a binary result, no anti-aliased blurring Instead, perform depth test for a neighborhood of pixels then compute percentage of lit pixels (this makes ε computation even trickier!) (5/9) Durand,Schulze Soft-Shadows with Shadow Map Look up several nearby shadow map fragments, not just one Compute average shadow value for the neighborhood use immediate neighbors for anti-aliasing use neighbors further afield for soft-shadows Sampling strategy: grid, jittered, or adaptive for improved performance

Ambient Occlusion Percentage-Closer Filtering All the real-time shadow algorithms assume directional lighting only Supported in hardware for small (2 2) filters shadow map coordinates generated using projection matrix Ambient occlusion is shadows due to global indirect/ambient lighting shadow map stored as texture: modern hardware permits tests on texture values can use larger filters with additional rendering passes Can be pre-computed using global illumination and baked into a texture limited to static scenes Yang et al., TP3 Durand,Schulze SSAO Ambient Occlusion Two approaches: At each point find fraction of hemisphere that is occluded Screen-space Ambient Occlusion (SSAO) Screen-space Directional Occlusion (SSDO) visible fraction: 1-occlusion modulate diffuse shading by Basic idea: approximate indirect lighting using a uniform, distant environment irradiance simulate the darkening effect where ambient light is blocked by other geometry in the scene (1 occlusion) cd = md sd max((n l), 0) (1 occlusion) Alternately, to avoid ray tracing, sample a circle around point compute the portion of the hemisphere around a point that is blocked purely geometric, independent of lighting conditions or viewing direction compare depth of samples against z-buffer content sample is not occluded if depth < z-buffer content TP3 Z Bala, Yang, Yip, Xu

SSDO SSAO plus EM and indirect lighting: p instead of modulating diffuse shading by (1 occlusion), add up light contribution from unoccluded directions only compute average un-occluded direction ( bent normal, b) lookup light/environment map using the bent normal result in light-colored shadow instead of just grey (can add a single bounce off facing occluding surfaces) Alternately, to avoid ray tracing, sample uniformly across the hemisphere above point, this gives N light vectors sample each light vector at random offsets from the point compare depth of samples against z-buffer content sample is not occluded if depth < z-buffer content n b Shadow and Environment Maps Basic method to add realism to interactive rendering: instead of ray tracing, use image-based methods Shadow maps: image-based hard shadows [Williams78] many recent extensions widely used even in software rendering (RenderMan) Environment maps: image-based complex lighting [Blinn&Newell76] huge amount of recent work Together, give many realistic effects but cannot be easily combined! Ritschel,Grosch,Seidel09 Ramamoorthi