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

Similar documents
Shadow Rendering EDA101 Advanced Shading and Rendering

Computer Graphics Shadow Algorithms

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

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

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

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

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

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

Real-Time Shadows. Last Time? Schedule. Questions? Today. 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!

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

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

Advanced Shading I: Shadow Rasterization Techniques

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

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Practical Shadow Mapping

Shadows in the graphics pipeline

Computer Graphics. Shadows

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

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

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

Computergrafik. Matthias Zwicker. Herbst 2010

Computer Graphics 10 - Shadows

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

The Traditional Graphics Pipeline

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

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

Shadows. COMP 575/770 Spring 2013

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

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Pipeline Operations. CS 4620 Lecture 10

Advanced Shading and Texturing

Rasterization Overview

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

EECS 487: Interactive Computer Graphics

High-quality Shadows with Improved Paraboloid Mapping

The Traditional Graphics Pipeline

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

Deferred Rendering Due: Wednesday November 15 at 10pm

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

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

Real-time Shadow Mapping

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Projective Textures & Shadow Mapping. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Shadows in Computer Graphics. by Björn Kühl im/ve University of Hamburg, Germany

Gaël Guennebaud Loïc Barthe, Mathias Paulin IRIT UPS CNRS TOULOUSE FRANCE Gaël Guennebaud Cyprus June 2006

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

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

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Real-Time Graphics Architecture

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

In- Class Exercises for Shadow Algorithms

CSE 167: Introduction to Computer Graphics Lecture #18: More Effects. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Volume Shadows Tutorial Nuclear / the Lab

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

An Optimized Soft Shadow Volume Algorithm with Real-Time Performance

Optimized Stencil Shadow Volumes. Cass Everitt & Mark J. Kilgard

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

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

Shadow Volume History (1) Shadow Volumes. Shadow Volume History (2) Shadow Volume History (3) Shadow Volume Basics. Shadow Volume History (4)

Drawing Fast The Graphics Pipeline

Shadow Mapping. Marc Stamminger, University of Erlangen-Nuremberg

Culling. Computer Graphics CSE 167 Lecture 12

Shadow Volumes Revisited

The Traditional Graphics Pipeline

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

LOD and Occlusion Christian Miller CS Fall 2011

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

Visibility and Occlusion Culling

Point based Rendering

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

Fondamenti di Grafica 3D The Rasterization Pipeline.

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Abstract. 2 Description of the Effects Used. 1 Introduction Phong Illumination Bump Mapping

3D Rasterization II COS 426

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

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

CSE528 Computer Graphics: Theory, Algorithms, and Applications

High Performance Visibility Testing with Screen Segmentation

CEng 477 Introduction to Computer Graphics Fall 2007

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

The Rasterization Pipeline

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

A Shadow Volume Algorithm for Opaque and Transparent Non-Manifold Casters

CC Shadow Volumes. Abstract. Introduction

CS 354R: Computer Game Technology

DOOM 3 : The guts of a rendering engine

Computer Graphics. Bing-Yu Chen National Taiwan University

CS4620/5620: Lecture 14 Pipeline

SHADOW RENDERING TECHNIQUES: HARD AND SOFT

Projection Matrix Tricks. Eric Lengyel

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

Practical Shadows. Outline

Projection and viewing. Computer Graphics CSE 167 Lecture 4

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

Drawing in 3D (viewing, projection, and the rest of the pipeline)

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

Transcription:

Projects Lecture 17: Shadows Proposals due today I will mail out comments Fall 2004 Kavita Bala Computer Science Cornell University Grading HW 1: will email comments asap Why Shadows? Crucial for spatial and depth perception Shadows Methods for fast shadows: s Shadow Volumes s Introduced by Lance Williams (SIGGRAPH 1978) Render scene from light s view black is close, white is far Using the When scene is viewed, check viewed location in light's shadow buffer If point's depth is (epsilon) greater than shadow depth, object is in shadow shadow depth map For each pixel, compare distance to light with the depth stored in the shadow map

ping: Pass 1 How s Work Depth testing from light s point-of-view Two pass algorithm First, render depth buffer from light s point-of-view Result is a depth map or shadow map A 2D function indicating the depth of the closest pixels to the light This depth map is used in the second pass Eye View How s Work ping: 2 nd pass Second, render scene from the eye s point-ofview Eye View For each rasterized fragment determine fragment s XYZ position relative to the light this light position should be setup to match the frustum used to create the depth map compare the depth value at light position XY in the depth map to fragment s light position Z ping: Comparison Two values A = Z value from depth map at fragment s light XY position B = Z value of fragment s XYZ light position If (B > A), There must be something closer to the light than the fragment So, fragment is shadowed If A and B are approximately equal, the fragment is lit Example: Shadowed The A < B shadowed fragment case light source fragment s light Z = B depth map image plane depth map Z = A eye position eye view image plane, a.k.a. the frame buffer

Example: Visible Example light source depth map image plane depth map Z = A eye position the point light source fragment s light Z = B eye view image plane, a.k.a. the frame buffer Example Issues Can only cast shadows over a frustum Use 6 (like a cube map) Get speckling because of floating point errors Use triangle ids Use bias If (B > A+bias) p in shadow with shadows without shadows Use triangle Ids Meshes? Issues Bias Issues How much polygon offset bias depends Bias If (B > A+bias) p in shadow If b is large? If b is small? Too little bias, speckling Too much bias, shadow starts too far back Just right

s on Hardware s use projective textures Treat texture as a light source (slide projector) Do not need to specify texture coordinates explicitly Spotlights Properties of s One shadow map per light Render scene twice per frame If static, can reuse Advantages Fast Easy to implement Disadvantages Bias Aliasing Hard shadows Source: Wolfgang Heidrich Aliasing (Distant) Aliasing in Eye View (Distant) Aliasing (Close) Where does aliasing occur? Fully Lit Shadow Boundary (Adequate Resolution) Fully Occluded Shadow Boundary (Inadequate Resolution)

Why does Aliasing arise? Light Shadows Methods for fast shadows: s Eye View Image Plane Shadow Volumes Eye View Projected Area!= Projected Area Crow 1977 Accurate shadows Shadow Volumes Shadow Volumes Clever counting method using stencil buffer Can cast shadows onto curved surfaces Image courtesy of BioWare Neverwinter Nights Mark Kilgard, NVIDIA Inc. Volume Concept Create volumes of space in shadow from light Each triangle creates 3 projecting quads Using the Volume To test a point, count the number of polygons between it and eye If more frontfacing than backfacing polygons, then in shadow Done with clever counting method using the stencil buffer backfacing frontfacing

Algorithm Finding volumes Project out shadow volumes Rendering Render scene into z-buffer, freeze z-buffer Draw front-facing volumes in front of pixel increment stencil Draw back-facing volumes in front of pixel decrement stencil If (cnt == 0) lit else shadow Multiple Shadow Volumes backfacing frontfacing Shadow Volumes Properties Performance: Use the silhouette for speed Near Plane Clip Issues What is a silhouette? V eye N 1 object N 2 N 1 V > 0 (forward facing) N 2 V < 0 (backward facing) Near plane clip discards part of shadow volume, messes up count Z-fail Approach But Far clipping plane problems? backfacing Use homogeneous coordinate to map to infinity frontfacing

Performance Have to render lots of huge polygons Front face increment Back face decrement Possible capping pass Uses a LOT fill rate Gives accurate shadows IF implemented correctly Need access to geometry if want to use silhouette optimization Summary Shadow maps Render scene twice per frame If static, can reuse Uses projective texturing, requires hardware support/shaders Shadow volumes Use stencil buffers Comparison s Adv: Fixed resolution, fast, simple Disadv: Bias, aliasing Shadow Volumes Adv: Accurate, high-quality Disadv: Fill-rate limited, hard to implement robustly Approaches to Improve Shadows Hard Shadows Adaptive s [Fernando, Fernandez, Bala, Greenberg] Shadow Silhouette Maps[Sen, Cammarano, Hanrahan] Hard and Soft Shadows Edge-and-Point Rendering [Bala, Walter Greenberg] Soft Shadows Next time Adaptive s: Motivation Fernando, Fernandez, Bala, Greenberg [SIG01] Shadow maps require too much tweaking Where to place light? What resolution to use? Goals: Address the aliasing problem No user intervention Interactive frame rate Adaptive s Idea: Refine shadow map on the fly Goal: Shade each eye pixel with a different shadow map pixel Implementation: Use hierarchical structure for shadow map Create/delete pieces of shadow map as needed Exploit fast rendering and frame buffer read-backs

ASM Data Structure Results: Images (Robot) Simple 2D tree: Resolution High Low Conventional (2048 x 2048 pixels) 16 MB Memory Usage Adaptive (Variable Resolution) 16 MB Memory Usage Results: Images (Robot Close-Up) Results: Images (Mesh) Conventional Adaptive 16 MB Memory Usage 16 MB Memory Usage Equivalent Conventional Size: 65,536 65,536 Pixels Conventional (2048 x 2048 pixels) 16 MB Memory Usage Adaptive (Variable Resolution) 16 MB Memory Usage Results: Images (Mesh Close-Up) Conventional Adaptive 16 MB Memory Usage 16 MB Memory Usage Equivalent Conventional Size: 65,536 65,536 Pixels