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

Similar documents
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. 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!

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

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

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

Computer Graphics Shadow Algorithms

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

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

The Traditional Graphics Pipeline

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

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

The Traditional Graphics Pipeline

Shadow Rendering EDA101 Advanced Shading and Rendering

Programmable GPUS. Last Time? Reading for Today. Homework 4. Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

The Traditional Graphics Pipeline

Shadows in the graphics pipeline

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

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

Shadows. COMP 575/770 Spring 2013

Computergrafik. Matthias Zwicker. Herbst 2010

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

Computer Graphics 10 - Shadows

Advanced Shading I: Shadow Rasterization Techniques

Computer Graphics. Shadows

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

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

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

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Graphics Hardware and Display Devices

Volume Shadows Tutorial Nuclear / the Lab

EECS 487: Interactive Computer Graphics

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

Rasterization Overview

In- Class Exercises for Shadow Algorithms

Pipeline Operations. CS 4620 Lecture 10

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

CS 354R: Computer Game Technology

Fondamenti di Grafica 3D The Rasterization Pipeline.

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Advanced Shading and Texturing

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

CS451Real-time Rendering Pipeline

Shadow Techniques. Sim Dietrich NVIDIA Corporation

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

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

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

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

CS4620/5620: Lecture 14 Pipeline

CHAPTER 1 Graphics Systems and Models 3

The Graphics Pipeline

Pipeline Operations. CS 4620 Lecture 14

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Creating soft shadows

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

Models and Architectures

Intro to Ray-Tracing & Ray-Surface Acceleration

Shadow Mapping. Marc Stamminger, University of Erlangen-Nuremberg

Real Time Reflections Han-Wei Shen

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1

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

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

Stencil Shadow Volumes

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

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

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

CSE4030 Introduction to Computer Graphics

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Computer Graphics I Lecture 11

Practical Shadows. Outline

Introduction to Computer Graphics with WebGL

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

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

Siggraph Full-Day Course #26. Real-Time Shadowing Techniques

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

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

Applications of Explicit Early-Z Culling

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

CS452/552; EE465/505. Clipping & Scan Conversion

Real-time Shadow Mapping

Enabling immersive gaming experiences Intro to Ray Tracing

CS 464 Review. Review of Computer Graphics for Final Exam

FRUSTUM-TRACED RASTER SHADOWS: REVISITING IRREGULAR Z-BUFFERS

Level of Details in Computer Rendering

Multi-View Soft Shadows. Louis Bavoil

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Topic #1: Rasterization (Scan Conversion)

Computer Graphics Introduction. Taku Komura

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Real Time Rendering of Expensive Small Environments Colin Branch Stetson University

Procedural modeling and shadow mapping. Computer Graphics CSE 167 Lecture 15

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

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

Transcription:

Last Time Modeling Transformations Illumination (Shading) Real-Time Shadows Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display Reading for Today: Ray Tracing on Programmable Graphics Hardware Purcell, Buck, Mark, & Hanrahan SIGGRAPH 22 Graphics Pipeline Clipping Rasterization

Today Why are Shadows Important? Depth cue Scene Lighting Realism Contact points Why are Shadows Important? Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Shadows as a Depth Cue

For Intuition about Scene Lighting Today Why are Shadows Important? Planar Shadows Projective Texture Shadows Position of the light (e.g. sundial) Hard shadows vs. soft shadows Colored lights Directional light vs. point light Shadow View Duality Texture Mapping Shadow Maps Shadow Volumes Cast Shadows on Planar Surfaces Limitations of Planar Shadows Draw the object primitives a second time, projected to the ground plane Does not produce self-shadows, shadows cast on other objects, shadows on curved surfaces, etc.

Shadow/View Duality Texture Mapping A point is lit if it is visible from the light source Don't have to represent everything with geometry Shadow computation similar to view computation Fake Shadows using Projective Textures Projective Texture Shadow Limitations Separate obstacle and receiver Compute b/w image of obstacle from light Use image as projective texture for each receiver Must specify occluder & receiver No self-shadows Resolution Image from light source BW image of obstacle Final image Figure from Moller & Haines Real Time Rendering Figure from Moller & Haines Real Time Rendering

Questions? Today Why are Shadows Important? Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Shadow Maps Shadow Mapping In Renderman Texture mapping with depth information Requires 2 passes through the pipeline: (High-end production software) Compute shadow map (depth from light source) Render final image, check shadow map to see if points are in shadow Foley et al. Computer Graphics Principles and Practice

Shadow Map Look Up Limitations of Shadow Maps We have a 3D point (x,y,z)ws How do we look up the depth from the shadow map? 1. Field of View 2. Bias (Epsilon) 3. Aliasing (x',y',z')ls (x,y,z)ws Use the 4x4 perspective projection matrix from the light source to get (x',y',z')ls ShadowMap(x',y') < z'? Foley et al. Computer Graphics Principles and Practice 1. Field of View Problem 2. The Bias (Epsilon) Nightmare What if point to shadow is outside field of view of shadow map? For a point visible from the light source Use cubical shadow map Use only spot lights! ShadowMap(x,y ) z How can we avoid erroneous self-shadowing? Add bias (epsilon)

2. Bias (Epsilon) for Shadow Maps 3. Shadow Map Aliasing ShadowMap(x,y ) + bias < z Choosing a good bias value can be very tricky Under-sampling of the shadow map Reprojection aliasing especially bad when the camera & light are opposite each other Correct image Not enough bias Way too much bias 3. Shadow Map Filtering 3. Percentage Closer Filtering Should we filter the depth? (weighted average of neighboring depth values) No... filtering depth is not meaningful Instead filter the result of the test (weighted average of comparison results) But makes the bias issue more tricky

3. Percentage Closer Filtering 5x5 samples Nice antialiased shadow Using a bigger filter produces fake soft shadows Setting bias is tricky Projective Texturing + Shadow Map Light s View Depth/Shadow Map Eye s View Images from Cass Everitt et al., Hardware Shadow Mapping NVIDIA SDK White Paper Shadows in Production Hardware Shadow Maps Often use shadow maps Ray casting as fallback in case of robustness issues Can be done with hardware texture mapping Texture coordinates u,v,w generated using 4x4 matrix Modern hardware permits tests on texture values

Questions? Today Why are Shadows Important? Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes The Stencil Buffer Stencil Buffer Stencil Buffer Real-time Mirror Tag pixels in one rendering pass to control their update in subsequent rendering passes Clear frame, depth & stencil buffers Draw all non-mirror geometry to frame & depth buffers Draw mirror to stencil buffer, where depth buffer passes Set depth to infinity, where stencil buffer passes Draw reflected geometry to frame & depth buffer, where without stencil buffer passes frame buffer "For all pixels in the frame buffer" "For all tagged pixels in the frame buffer" Can specify different rendering operations for each case: depth buffer stencil test fails stencil test passes & depth test fails stencil test passes & depth test passes See NVIDIA's stencil buffer tutorial http://developer.nvidia.com stencil buffer also discusses blending, multiple mirrors, objects behind mirror, etc stencil buffer: reflected geometry

Shadow Volumes Shadow Volumes Explicitly represent the volume of space in shadow For each polygon If a point is inside a shadow volume cast by a particular light, the point does not receive any illumination from that light Pyramid with point light as apex Include polygon to cap Cost of naive implementation: #polygons * #lights Shadow test similar to clipping Shadow Volumes Shadow Volumes w/ the Stencil Buffer Shoot a ray from the eye to the visible point Increment/decrement a counter each time we intersect a shadow volume polygon (check z buffer) -1 If the counter, the point is in shadow Initialize stencil buffer to Draw scene with ambient light only Turn off frame buffer & z-buffer updates Draw front-facing shadow polygons If z-pass increment counter Draw back-facing shadow polygons If z-pass decrement counter Turn on frame buffer updates Turn on lighting and redraw pixels with counter = +1 +1 +1 +2

If the Eye is in Shadow... 1. Test Eye with Respect to Volumes... then a counter of does not necessarily mean lit 3 Possible Solutions: Adjust initial counter value 1. Explicitly test eye point with respect to all shadow volumes 2. Clip the shadow volumes to the view frustum -1 3. "Z-Fail" shadow volumes Expensive -1 +1 +1 2. Clip the Shadow Volumes 3. "Z-Fail" Shadow Volumes Clip the shadow volumes to the view frustum and include these new polygons Messy CSG Start at infinity... Draw front-facing shadow polygons If z-fail, decrement counter Draw back-facing shadow polygons If z-fail, increment counter... +1

3. "Z-Fail" Shadow Volumes Optimizing Shadow Volumes Use silhouette edges only (edge where a back-facing & front-facing polygon meet) Introduces problems with far clipping plane Solved by clamping the depth during clipping +1 Limitations of Shadow Volumes Homework 4 Introduces a lot of new geometry Expensive to rasterize long skinny triangles Limited precision of stencil buffer (counters) Create some geometry for a really complex scene/object, the counter can overflow Objects must be watertight to use silhouette trick Rasterization of polygons sharing an edge must not overlap & must not have gap Reflected object & floor Silhouette edges Shadow polygons Make sure your polygons aren t doubled up Make sure your polygons are oriented consistently Mess with the stencil buffer Don t just blindly copy code from the tutorial Use the web to read the man page for each instruction & its parameters Be creative with shaders Hopefully everyone can get the examples to compile & run

Questions? Reading for Tuesday: From a previous quiz: Check the boxes to indicate the features & limitations of each technique Shadow Algorithms for Computer Graphics, Frank Crow, SIGGRAPH 1977 Reading for HW4: Reading for Tuesday: Improving Shadows and Reflections via the Stencil Buffer, Mark Kilgard, NVIDIA Shadow Algorithms for Computer Graphics, Frank Crow, SIGGRAPH 1977

Reading for Tuesday: Reading for Tuesday: "Rendering Fake Soft Shadows with Smoothies", Chan & Durand, EGSR 23 "Deep Opacity Maps", Yuksel and Keyser, Eurographics 28