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

Slides:



Advertisements
Similar presentations
Exploration of advanced lighting and shading techniques
Advertisements

An Optimized Soft Shadow Volume Algorithm with Real-Time Performance Ulf Assarsson 1, Michael Dougherty 2, Michael Mounier 2, and Tomas Akenine-Möller.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Optimized Stencil Shadow Volumes
Graphics Pipeline.
Optimized Stencil Shadow Volumes
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Week 9 - Friday.  What did we talk about last time?  Area lighting  Environment mapping  Blinn and Newell's method  Sphere mapping  Cubic environmental.
Computer Graphics methods
Course Note Credit: Some of slides are extracted from the course notes of prof. Mathieu Desburn (USC) and prof. Han-Wei Shen (Ohio State University). CSC.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Shadow and Shadow Maps [5]. Object without shadow seem floating above the scene Shadow gives the depth information Shadow gives the information of the.
1 Dr. Scott Schaefer Shadows. 2/40 Shadows Shadows provide clues about depth Make scenes appear more realistic.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering Cass Everitt and Mark J. Kilgard Speaker: Alvin Date: 5/28/2003 NVIDIA.
A Real-Time Soft Shadow Volume Algorithm DTU Vision days Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology Sweden
(conventional Cartesian reference system)
Shadow Algorithms Gerald Matzka Computer Science Seminar.
Real-Time High Quality Rendering COMS 6160 [Fall 2004], Lecture 4 Shadow and Environment Mapping
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University.
Advanced Texture Mapping May 10, Today’s Topics Mip Mapping Projective Texture Shadow Map.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
© 2004 Tomas Akenine-Möller1 Shadow Generation Hardware Vision day at DTU 2004 Tomas Akenine-Möller Lund University.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
Computer Graphics Shadows
1 A Hierarchical Shadow Volume Algorithm Timo Aila 1,2 Tomas Akenine-Möller 3 1 Helsinki University of Technology 2 Hybrid Graphics 3 Lund University.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Hidden Surface Removal
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Computer Graphics Mirror and Shadows
Shadow Algorithms Ikrima Elhassan.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Computer graphics & visualization REYES Render Everything Your Eyes Ever Saw.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Computer graphics & visualization Shadows / Transparency.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.
RENDERING : Global Illumination
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadows & occlusion  Shadow - occlusion duality  Floor shadows.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Discrete Techniques.
The Graphics Rendering Pipeline
Jim X. Chen George Mason University
© University of Wisconsin, CS559 Fall 2004
(c) 2002 University of Wisconsin
Real-time Rendering Shadow Maps
Real-Time Rendering Intro to Shadows
UMBC Graphics for Games
A Hierarchical Shadow Volume Algorithm
Frame Buffer Applications
Presentation transcript:

MIT EECS 6.837, Durand and Cutler Real-Time Shadows

MIT EECS 6.837, Durand and Cutler Last Time? Perspective-Correct Interpolation Texture Coordinates Procedural Solid Textures Other Mapping –Bump –Displacement –Environment –Lighting

MIT EECS 6.837, Durand and Cutler Textures can Alias Aliasing is the under-sampling of a signal, and it's especially noticeable during animation nearest neighbor mipmaps & linear interpolation

MIT EECS 6.837, Durand and Cutler Schedule Quiz 1: Tuesday October 26 th, in class (1 week from today!) Review Session: Monday October 25 th, 7:30-9pm, Assignment 6: due Wednesday November 3 rd

MIT EECS 6.837, Durand and Cutler RayTracer::traceRay confusion OUTPUT: radiance (color & amount of light) along direction OUTPUT: intersection point Vec3f RayTracer::traceRay(Ray &ray, float tmin, int bounces, float weight, float indexOfRefraction, Hit &hit) 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)

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

MIT EECS 6.837, Durand and Cutler Why are Shadows Important? Depth cue Scene Lighting Realism Contact points

MIT EECS 6.837, Durand and Cutler Shadows as a Depth Cue

MIT EECS 6.837, Durand and Cutler For Intuition about Scene Lighting Position of the light (e.g. sundial) Hard shadows vs. soft shadows Colored lights Directional light vs. point light

MIT EECS 6.837, Durand and Cutler Shadows as the Origin of Painting

MIT EECS 6.837, Durand and Cutler Shadows and Art Only in Western pictures (here Caravaggio)

MIT EECS 6.837, Durand and Cutler Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

MIT EECS 6.837, Durand and Cutler Shadows One shadow ray per intersection per point light source no shadow rays one shadow ray

MIT EECS 6.837, Durand and Cutler Soft Shadows Caused by extended light sources Umbra –source completely occluded Penumbra –Source partially occluded Fully lit

MIT EECS 6.837, Durand and Cutler Soft Shadows Multiple shadow rays to sample area light source one shadow ray lots of shadow rays

MIT EECS 6.837, Durand and Cutler 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

MIT EECS 6.837, Durand and Cutler Traditional Ray Tracing

MIT EECS 6.837, Durand and Cutler Ray Tracing + Soft Shadows

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler 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

MIT EECS 6.837, Durand and Cutler Cast Shadows on Planar Surfaces Draw the object primitives a second time, projected to the ground plane

MIT EECS 6.837, Durand and Cutler Limitations of Planar Shadows Does not produce self-shadows, shadows cast on other objects, shadows on curved surfaces, etc.

MIT EECS 6.837, Durand and Cutler Shadow/View Duality A point is lit if it is visible from the light source Shadow computation similar to view computation

MIT EECS 6.837, Durand and Cutler Texture Mapping Don't have to represent everything with geometry

MIT EECS 6.837, Durand and Cutler 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 sourceBW image of obstacleFinal image Figure from Moller & Haines “Real Time Rendering”

MIT EECS 6.837, Durand and Cutler Projective Texture Shadow Limitations Must specify occluder & receiver No self-shadows Resolution Figure from Moller & Haines “Real Time Rendering”

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

MIT EECS 6.837, Durand and Cutler Shadow Maps In Renderman –(High-end production software)

MIT EECS 6.837, Durand and Cutler Shadow Mapping Texture mapping with depth information Requires 2 passes through the pipeline: –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”

MIT EECS 6.837, Durand and Cutler Shadow Map Look Up We have a 3D point (x,y,z) WS How do we look up the depth from the shadow map? 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” (x,y,z) WS (x',y',z') LS

MIT EECS 6.837, Durand and Cutler Limitations of Shadow Maps 1.Field of View 2.Bias (Epsilon) 3.Aliasing

MIT EECS 6.837, Durand and Cutler 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!

MIT EECS 6.837, Durand and Cutler 2. The Bias (Epsilon) Nightmare For a point visible from the light source ShadowMap(x’,y’)  z’ How can we avoid erroneous self-shadowing? –Add bias (epsilon)

MIT EECS 6.837, Durand and Cutler 2. Bias (Epsilon) for Shadow Maps ShadowMap(x’,y’) + bias < z’ Choosing a good bias value can be very tricky Correct imageNot enough biasWay too much bias

MIT EECS 6.837, Durand and Cutler 3. Shadow Map Aliasing Under-sampling of the shadow map Reprojection aliasing – especially bad when the camera & light are opposite each other

MIT EECS 6.837, Durand and Cutler 3. Shadow Map Filtering Should we filter the depth? (weighted average of neighboring depth values) No... filtering depth is not meaningful

MIT EECS 6.837, Durand and Cutler 3. Percentage Closer Filtering Instead filter the result of the test (weighted average of comparison results) But makes the bias issue more tricky

MIT EECS 6.837, Durand and Cutler 3. Percentage Closer Filtering 5x5 samples Nice antialiased shadow Using a bigger filter produces fake soft shadows Setting bias is tricky

MIT EECS 6.837, Durand and Cutler Projective Texturing + Shadow Map Eye’s View Light’s ViewDepth/Shadow Map Images from Cass Everitt et al., “Hardware Shadow Mapping” NVIDIA SDK White Paper

MIT EECS 6.837, Durand and Cutler Shadows in Production Often use shadow maps Ray casting as fallback in case of robustness issues

MIT EECS 6.837, Durand and Cutler Hardware Shadow Maps Can be done with hardware texture mapping –Texture coordinates u,v,w generated using 4x4 matrix –Modern hardware permits tests on texture values

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes –The Stencil Buffer

MIT EECS 6.837, Durand and Cutler 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

MIT EECS 6.837, Durand and Cutler Stencil Buffer – Real-time Mirror 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 also discusses blending, multiple mirrors, objects behind mirror, etc… without stencil buffer: reflected geometry

MIT EECS 6.837, Durand and Cutler Shadow Volumes 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

MIT EECS 6.837, Durand and Cutler 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

MIT EECS 6.837, Durand and Cutler Shadow Volumes 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 ≠ 0, the point is in shadow +1 +1

MIT EECS 6.837, Durand and Cutler Shadow Volumes w/ the Stencil Buffer Initialize stencil buffer to 0 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 =

MIT EECS 6.837, Durand and Cutler If the Eye is in Shadow then a counter of 0 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 3. "Z-Fail" shadow volumes 0

MIT EECS 6.837, Durand and Cutler 1. Test Eye with Respect to Volumes Adjust initial counter value Expensive

MIT EECS 6.837, Durand and Cutler 2. Clip the Shadow Volumes Clip the shadow volumes to the view frustum and include these new polygons Messy CSG

MIT EECS 6.837, Durand and Cutler 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

MIT EECS 6.837, Durand and Cutler 3. "Z-Fail" Shadow Volumes Introduces problems with far clipping plane Solved by clamping the depth during clipping

MIT EECS 6.837, Durand and Cutler Optimizing Shadow Volumes Use silhouette edges only (edge where a back-facing & front-facing polygon meet)

MIT EECS 6.837, Durand and Cutler 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

MIT EECS 6.837, Durand and Cutler Questions? From last year’s quiz: Check the boxes to indicate the features & limitations of each technique

MIT EECS 6.837, Durand and Cutler Next Time: Global Illumination: Radiosity & The Rendering Equation