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

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

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

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

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

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

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

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

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

Computer Graphics Shadow Algorithms

Computergrafik. Matthias Zwicker. Herbst 2010

Shadow Rendering EDA101 Advanced Shading and Rendering

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

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

Advanced Shading I: Shadow Rasterization Techniques

Shadows. COMP 575/770 Spring 2013

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Shadows in the graphics pipeline

Computer Graphics 10 - Shadows

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

The Traditional Graphics Pipeline

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

Computer Graphics. Shadows

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

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

The Traditional Graphics Pipeline

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

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

Volume Shadows Tutorial Nuclear / the Lab

The Traditional Graphics Pipeline

Rasterization Overview

Topics and things to know about them:

CS 354R: Computer Game Technology

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

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

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

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

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

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

Graphics Hardware and Display Devices

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

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

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

Introduction to Computer Graphics with WebGL

Local vs. Global Illumination & Radiosity

Advanced Shading and Texturing

Shadow Techniques. Sim Dietrich NVIDIA Corporation

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Recall: Indexing into Cube Map

CS4620/5620: Lecture 14 Pipeline

CSE528 Computer Graphics: Theory, Algorithms, and Applications

EECS 487: Interactive Computer Graphics

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

Models and Architectures

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

Last Time? Ray Casting. Administrivia: Lab & Office Hours. Notes on Assignments. Ray Casting. Overview of Today

CS451Real-time Rendering Pipeline

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

Pipeline Operations. CS 4620 Lecture 10

Intro to Ray-Tracing & Ray-Surface Acceleration

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

03 RENDERING PART TWO

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

CSE4030 Introduction to Computer Graphics

Announcements. Written Assignment 2 is out see the web page. Computer Graphics

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.

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

Computer Graphics Introduction. Taku Komura

CHAPTER 1 Graphics Systems and Models 3

3D Rasterization II COS 426

Shadow Mapping. Marc Stamminger, University of Erlangen-Nuremberg

REYES REYES REYES. Goals of REYES. REYES Design Principles

Creating soft shadows

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

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

Level of Details in Computer Rendering

Fondamenti di Grafica 3D The Rasterization Pipeline.

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

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

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Computer Graphics I Lecture 11

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

RASTERISED RENDERING

TSBK03 Screen-Space Ambient Occlusion

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

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

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 Reflections Han-Wei Shen

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

Computer Graphics. Lecture 9 Environment mapping, Mirroring

FRUSTUM-TRACED RASTER SHADOWS: REVISITING IRREGULAR Z-BUFFERS

Enabling immersive gaming experiences Intro to Ray Tracing

Transcription:

Last Time? Real-Time Shadows Perspective-Correct Interpolation Texture Coordinates Procedural Solid Textures Other Mapping Bump Displacement Environment Lighting Textures can Alias Aliasing is the under-sampling of a signal, and it's especially noticeable during animation Schedule Quiz 1: Tuesday October 26 th, in class (1 week from today!) nearest neighbor Review Session: Monday October 25 th, 7:3-9pm, 1-15 Assignment 6: due Wednesday November 3 rd mipmaps & linear interpolation RayTracer::traceRay confusion Questions? Vec3f RayTracer::traceRay(Ray &ray, float tmin, int bounces, float weight, OUTPUT: radiance (color & amount of light) along direction float indexofrefraction, Hit &hit) OUTPUT: intersection point scene->getgroup()->intersect(ray,hit,t) should only be called once, from within RayTracer::traceRay ** This will help you implement and debug fast raytracing (assignment 6)

Today Why are Shadows Important? Depth cue Scene Lighting Realism Contact points Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Shadows as a Depth Cue For Intuition about Scene Lighting Shadows as the Origin of Painting Position of the light (e.g. sundial) Hard shadows vs. soft shadows Colored lights Directional light vs. point light Shadows and Art Only in Western pictures (here Caravaggio) 2

Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Shadows One shadow ray per intersection per point light source no shadow rays one shadow ray Soft Shadows Caused by extended light sources Umbra source completely occluded Penumbra Source partially occluded Fully lit Soft Shadows Multiple shadow rays to sample area light source one shadow ray lots of shadow rays Shadows in Ray Tracing Shoot ray from visible point to light source If blocked, discard light contribution Optimizations? Stop after first intersection (don t worry about tmin) Coherence: remember the previous occluder, and test that object first Traditional Ray Tracing

Ray Tracing + Soft Shadows Questions? Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow View Duality Texture Mapping Shadow Maps Shadow Volumes Cast Shadows on Planar Surfaces Draw the object primitives a second time, projected to the ground plane Limitations of Planar Shadows Does not produce self-shadows, shadows cast on other objects, shadows on curved surfaces, etc. Shadow/View Duality A point is lit if it is visible from the light source Shadow computation similar to view computation

Texture Mapping Don't have to represent everything with geometry Fake Shadows using Projective Textures Separate obstacle and receiver Compute b/w image of obstacle from light Use image as projective texture for each receiver Image from light source BW image of obstacle Final image Figure from Moller & Haines Real Time Rendering Projective Texture Shadow Limitations Questions? Must specify occluder & receiver No self-shadows Resolution Figure from Moller & Haines Real Time Rendering Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Shadow Maps In Renderman (High-end production software)

Shadow Mapping Shadow Map Look Up Texture mapping with depth information Requires 2 passes through the pipeline: We have a 3D point (x,y,z) WS How do we look up the depth from the shadow map? Compute shadow map (depth from light source) Render final image, check shadow map to see if points are in shadow Use the 4x4 perspective projection matrix from the light source to get (x',y',z') LS ShadowMap(x',y') < z'? (x',y',z') LS (x,y,z) WS Foley et al. Computer Graphics Principles and Practice Foley et al. Computer Graphics Principles and Practice Limitations of Shadow Maps 1. Field of View 2. Bias (Epsilon) 3. Aliasing 1. Field of View Problem What if point to shadow is outside field of view of shadow map? Use cubical shadow map Use only spot lights! 2. The Bias (Epsilon) Nightmare For a point visible from the light source ShadowMap(x,y ) z 2. Bias (Epsilon) for Shadow Maps ShadowMap(x,y ) + bias < z Choosing a good bias value can be very tricky How can we avoid erroneous self-shadowing? Add bias (epsilon) Correct image Not enough bias Way too much bias

3. Shadow Map Aliasing Under-sampling of the shadow map Reprojection aliasing especially bad when the camera & light are opposite each other 3. Shadow Map Filtering Should we filter the depth? (weighted average of neighboring depth values) No... filtering depth is not meaningful 3. Percentage Closer Filtering 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 Shadows in Production Often use shadow maps Ray casting as fallback in case of robustness issues Light s View Depth/Shadow Map Eye s View Images from Cass Everitt et al., Hardware Shadow Mapping NVIDIA SDK White Paper

Hardware Shadow Maps Questions? Can be done with hardware texture mapping Texture coordinates u,v,w generated using 4x4 matrix Modern hardware permits tests on texture values Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes The Stencil Buffer Stencil Buffer Tag pixels in one rendering pass to control their update in subsequent rendering passes "For all pixels in the frame buffer" "For all tagged pixels in the frame buffer" Can specify different rendering operations for each case: stencil test fails stencil test passes & depth test fails stencil test passes & depth test passes frame buffer depth buffer stencil buffer Stencil Buffer Real-time Mirror Shadow Volumes 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 stencil buffer passes See NVIDIA's stencil buffer tutorial http://developer.nvidia.com without stencil buffer: also discusses blending, multiple mirrors, objects behind mirror, etc reflected geometry Explicitly represent the volume of space in shadow For each polygon Pyramid with point light as apex Include polygon to cap Shadow test similar to clipping

Shadow Volumes Shadow Volumes If a point is inside a shadow volume cast by a particular light, the point does not receive any illumination from that light Cost of naive implementation: #polygons * #lights 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) If the counter, the point is in shadow -1 Shadow Volumes w/ the Stencil Buffer If the Eye 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 = +2... then a counter of does not necessarily mean lit 3 Possible Solutions: 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 -1 1. Test Eye with Respect to Volumes 2. Clip the Shadow Volumes Adjust initial counter value Expensive Clip the shadow volumes to the view frustum and include these new polygons Messy CSG

3. "Z-Fail" Shadow Volumes 3. "Z-Fail" Shadow Volumes Start at infinity... Draw front-facing shadow polygons If z-fail, decrement counter Draw back-facing shadow polygons If z-fail, increment counter Introduces problems with far clipping plane Solved by clamping the depth during clipping... Optimizing Shadow Volumes Use silhouette edges only (edge where a back-facing & front-facing polygon meet) A L Limitations of Shadow Volumes Introduces a lot of new geometry Expensive to rasterize long skinny triangles Limited precision of stencil buffer (counters) 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 Questions? From last year s quiz: Check the boxes to indicate the features & limitations of each technique Next Time: Global Illumination: Radiosity & The Rendering Equation