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

Similar documents
Computer Graphics Shadow Algorithms

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

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

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

Computer Graphics. Shadows

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

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

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

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

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

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

Shadow Rendering EDA101 Advanced Shading and Rendering

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

Computer Graphics 10 - Shadows

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

The Traditional Graphics Pipeline

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

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

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

In- Class Exercises for Shadow Algorithms

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

Rasterization Overview

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

Shadows in the graphics pipeline

The Traditional Graphics Pipeline

Stencil Shadow Volumes

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

Computergrafik. Matthias Zwicker. Herbst 2010

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

The Traditional Graphics Pipeline

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

Pipeline Operations. CS 4620 Lecture 10

RASTERISED RENDERING

Projection Matrix Tricks. Eric Lengyel

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Computer Graphics. Bing-Yu Chen National Taiwan University

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

Advanced Shading I: Shadow Rasterization Techniques

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

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

Culling. Computer Graphics CSE 167 Lecture 12

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

Practical 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

Shadows. COMP 575/770 Spring 2013

COMPUTER GRAPHICS COURSE. Rendering Pipelines

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Advanced Shading and Texturing

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

LOD and Occlusion Christian Miller CS Fall 2011

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

Visibility and Occlusion Culling

Basic GPU techniques Josef Pelikán CGG MFF UK Praha.

Hidden Surface Removal

Pipeline Operations. CS 4620 Lecture 14

Creating soft shadows

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

High Performance Visibility Testing with Screen Segmentation

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

CEng 477 Introduction to Computer Graphics Fall 2007

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

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

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

Practical Shadows. Outline

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

Deferred Rendering Due: Wednesday November 15 at 10pm

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

Volume Shadows Tutorial Nuclear / the Lab

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

Hidden surface removal. Computer Graphics

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Real-Time Universal Capture Facial Animation with GPU Skin Rendering

3D Rasterization II COS 426

An Optimized Soft Shadow Volume Algorithm with Real-Time Performance

Simpler Soft Shadow Mapping Lee Salzman September 20, 2007

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

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

3D Editing System for Captured Real Scenes

CHAPTER 1 Graphics Systems and Models 3

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

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

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

Shadow Mapping. Render Scene and Access the Depth Texture. What is Projective Texturing? About Projective Texturing (1) About Projective Texturing (3)

Occlusion Detection of Real Objects using Contour Based Stereo Matching

Drawing Fast The Graphics Pipeline

CS451Real-time Rendering Pipeline

Spring 2009 Prof. Hyesoon Kim

Interpolation using scanline algorithm

9. Illumination and Shading

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

Photorealism: Ray Tracing

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Fondamenti di Grafica 3D The Rasterization Pipeline.

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

The Rasterization Pipeline

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Transcription:

Overview A real-time shadow approach for an Augmented Reality application using shadow volumes Introduction of Concepts Standard Stenciled Shadow Volumes Method Proposed Approach in AR Application Experimental Results and Examples Evaluation and Improvement Analysis References 1 2 Augmented Reality AR is defined by three desired characteristics: 1) Combines real and virtual 2) Interactive in real time 3) Registered in 3-D Augmented Reality 3 4

What s Shadow? Shadow Volume Shadow Categories Hard Shadow (Opaque occluder & point light) Soft Shadow (Opaque occluder & area light) Complex Shadow (Transparent occluder) Shadow Volume It defines a region of space that is in the shadow of a particular occluder given a particular ideal light source. 5 6 Hard Shadow Soft Shadow 7 8

Hard Shadow vs. Soft Shadow Shadow Volume 9 1 Shadow Volume Visualization OpenGL Scene with shadows Visualization of the shadow volume Light source OpenGL - 3D supported graphic software and provide geometric primitives - points, lines, polygons, images, and bitmaps. commands - allow the specification of geometric objects in two or three dimensions; control how objects are rendered into the frame buffer. 11 12

Buffer Mechanism Z Buffer & Stencil Buffer & Frame Buffer All buffers that store attributes for each pixel can be called as Frame Buffer, which can be divided into 4 categories below, -- Color Buffer, caches color indexes or RGBA value. -- Depth Buffer (Z-Buffer), caches depth information for each pixel. -- Stencil Buffer, caches some portions of the whole image or scene for re-rendering quickly. -- Accumulation Buffer, used to synthesize image. ZPass & ZFail Test The OpenGL depth test function is used to compare each incoming pixel z value with the z value present in the depth buffer. The comparison is performed only if depth testing is enabled. If the test procedure by the OpenGL function passes, we call this test ZPass, otherwise ZFail. We can image these two possibilities as the same in adverse test orientations: -- one tests along the Z direction; -- the other along the Z negative direction. 13 14 Homegeneous Coordinates Suppose we have a point (x, y) in the Euclidean plane. To represent this point in the projective plane, we simply add a third coordinate of 1 at the end: (x, y,1). Overall scaling is unimportant, so the point (x,y,1) is the same as the point, for any non. Clip Planes Clip Planes: Geometry is always clipped against the boundaries of a six-plane frustum in x, y, and z. Because scaling is unimportant, the coordinates (X,Y,W) are called the homogeneous coordinates of the point. To denote a infinite point, let w equals such as (x, y, ). 15 16

Clip Planes Standard Stenciled Shadow Volumes Methods Light source Shadowing object Eye position +2 +2 +3 17 18 Standard Stenciled Shadow Volumes Methods Standard Stenciled Shadow Volumes Methods Light source Shadowing object Light source Shadowing object Eye position + + + - - - +2 +2 +3 Unshadowed object Eye position Shadow Volume Count = -1-1-1 = 19 2 + + + - Shadowed object +2 +2 +3 Shadow Volume Count = -1 = 2

Standard Stenciled Shadow Volumes Methods Generation of shadow volumes # Initialize the depth buffer and color buffer # Then twice using face culling and don t update depth or color 1st pass: render front faces and increment when depth passes, viz. ZPass (or decrement when depth fails, viz. ZFail) 2nd pass: render back faces and decrement when depth passes, viz. ZPass (or increment when depth fails, viz. ZFail) Standard Stenciled Shadow Volumes Methods Too simple? Maybe there are other unconsidered problems practically, so before we starting analysis it we can show you some photos from practical applications using OpenGL. 21 22 Standard Stenciled Shadow Volumes Methods Standard Stenciled Shadow Volumes Methods Why does it occur aliasing when we present the closer shadow effect? Do you remember the clip planes talked just now? Remark: so we can determine that the intrinsic cause leads to aliasing is clip planes. Since a real OpenGL space is NOT an ideal 3D model corresponding real world. so when we generate our shadow volumes, we can NOT assure that those shadow volumes are CLOSED polygons. Furthermore, this error will lead error count for shadow volumes number of pixel. 23 24

Problems with Near Plane Clipping (zpass approach) Capping Shadow Volumes at the Near Clip Plane Missed shadow volume intersection due to near clip plane clipping +2 +3 +2 Far clip plane Shadow volume edge is capped to keep shadow volume enter/leave counts correct +2 +3 +2 3D version of the problem is harder than 2D case! Near clip plane 25 26 Standard Stenciled Shadow Volumes Methods Problems Caused by Near Clip Plane We illustrate the problems caused by near clipping plane when we using zpass method; Similarly we will face to far clipping plane problems when we in zfail way. Z-Pass Algorithm We count the number of shadow volumes for some pixel from the eye point to the first resterized visible pixel. So aliasing is due to near plane clipping. Z-Fail Algorithm We count the number of shadow volumes for some pixel from the infinite to the pixel. So aliasing is due to far plane clipping. 27 28

ZPass Analysis According to the diagram, we can conclude that even when done carefully, shadow volume near plane capping is treacherous because of the fragile nature of required rayplane intersections and the inability to guarantee identical and bit-exact computations. So can we avoid the near plane clipping? Sure! We can use the zfail method. We must mention that shifts the problem to the far plane clipping shadow volumes. Alternative Approach: Zfail Render scene to initialize depth buffer Depth values indicate the closest visible fragments Use a stencil enter/leave counting approach Draw shadow volume twice using face culling 1st pass: render back faces and increment when depth test fails 2nd pass: render front faces and decrement when depth test fails Don t update depth or color Then, pixel s stencil is non- if pixel in shadow, and if illuminated 29 3 Zfail versus Zpass Comparison Perspective Projection When stencil increment/decrements occur Zpass: on depth test pass Zfail: on depth test fail Increment on Zpass: front faces Zfail: back faces Decrement on Zpass: back faces Zfail: front faces z V y V z = - f ( far plane ) (l,, b, -n ) (r,, t, -n ) x V z = - n ( near plane ) view frustum 31 32

Projective Matrix Standrad Stenciled Shadow Volumes Methods 2 Near Right Left P = 2 Near Top Bottom Right + Left Right Left Top + Bottom Top Bottom Far + Near Far Near 1 2 Far Near Far Near We consider the limit of P as the far clip plane distance is driven to infinity Only third row depends on Far and Near 33 34 Verifying Pinf will not clip infinitely far away vertices Transform eye-space (,,-D,) to clip-space 2 Near Right + Left x c xc Right Left Right Left yc y c 2 Near Top + Bottom = = D z Top Bottom Top Bottom c D D 1 2 Near wc 1 Then, assuming gldepthrange(,1), transform clip-space position to window-space position z c D z w =. 5 +. 5 =. 5 +. 5 = 1 w c D So in front of eye transforms to the maximum window-space Z value, but is still within the valid depth range (i.e., not clipped) Rendering closed, but infinite, shadow volumes To be robust, the shadow volume geometry must be closed, even at infinity. To close a shadow volume completely, we must combine three sets of polygons: -- all of the possible silhouette polygon edges extruded to infinity away from the light -- all of the occluder s back-facing triangles, with respect to L, projected away from the light to infinity -- all of the occluder s front-facing triangles with respect to L 35 36

Summary for Rendering Procedure Standrad Stenciled Shadow Volumes Methods 1. Placing the conventional far clip plane at infinity 2. Rasterizing infinite (but fully closed) shadow volume polygons via homogeneous coordinates 3. Adopting the zfail stencil-testing scheme The following diagram show the implementation steps. 37 38 Proposed Approach in AR Application Differences between VR and AR All objects in VR are virtual, but In AR some are real ones. So AR is a hybrid world with real and virtual objects, then we should face to the following problems that don t occur in VR scenes. Q1. How to metric the geometry characteristics of real objects? Q2. Which order we should render the shadow in? Shading and Shadows in AR For Augmented Reality applications: consistency of geometry; consistency of time (smooth interaction); consistency of illumination. A real-time estimation of the position and the direction of the real light source is required to calculate the right shading and shadows of the virtual objects. (real-time shadows of real/virtual objects onto real/virtual objects) 39 4

Remodelling and Relighting Real Scenes Proposed Approach in AR Application Two sets of photographs to estimate the geometry and the lighting model of the real scene: The first set consists of images of the scene taken from different viewpoints; The second set consists of images of the scene taken from one viewpoint but with a real light source at different positions. The system permits interactive modification of the scene geometry, including removing objects and adding, changing or removing light sources. Real objects are represented by virtual objects that are invisible for the user, called phantom objects. It is NOT necessary to have the exact phantom model for each real object in the world. We can start to calculate the silhouette of both kinds of objects (virtual and real) and extrude the shadow volume. The implementation of the silhouette calculation and the extrusion of the shadow volume can be easily implemented with the same method as in the standard stenciled shadow volume algorithm. 41 42 Proposed Approach in AR Application Proposed Approach in AR Application 43 44

Proposed Approach in AR Application Four possibilities of shadow casts R V R V R V R V R V R V 45 46 Proposed Approach in AR Application Proposed Approach in AR Application Rendering steps As the algorithm has to work for all cases, for real/virtual objects that cast shadows onto real/virtual objects, the four different cases are rendered in the following three steps: Step 1: Real objects cast their shadows onto real objects Step 2: Virtual objects cast their shadows onto real objects Step 3: Real and virtual objects cast their shadows onto virtual objects 1. R->R works with a normal webcam. 2. V->R use the phantom (virtual 3D models of real objects) and shadow volumes of virtual objects to get this effect, using the method of standard stenciled shadow volumes algorithm. Since missing the material information from the real word, we use black and transparent shadow polygons that are blended over the parts of the real scene (real image). 47 48

Proposed Approach in AR Application Proposed Approach in AR Application 3. R->V &V->V render the whole scenes which include phantom (virtual 3D models of real objects) with diffuse and specular components into the stencil buffer. (to generate shadow volumes for both virtual and real objects and draw the shadow volume polygons into the stencil buffer). 49 5 Proposed Approach in AR Application Experiments The real scene is represented by virtual phantom models; The virtual light position and its properties are independent of the real light conditions; The position and orientation tracking of the real object is accomplished by using ARToolKit as marker detection system; No any animated objects; The augmented shadows enhance the real scene a great deal and offer the user a more intuitive and very photorealistic world. 51 52

Experimental Results and Examples Experimental Results and Examples 53 54 Experimental Results and Examples Experimental Results and Examples 55 56

Conclusion Proposed a Shadow Volume based shadow rendering algorithm for AR applications. A modified real-time Shadow Volume algorithm Multi-steps rendering procedure based on relations betweens real and virtual objects Volume algorithm improvement Volume algorithm can be improved by using Portals, BSP and some other techniques that avoid the rendering of unnecessary shadow volumes. Using nvidia's shading language Cg Improvement of the shadows (e.g. soft shadows) Evaluation and Improvement Analysis As showed in examples, the orientation of light source is virtual and specified manually. Naturally, can we give an estimation model for real light in real scenes? Then we can reconstruct the shadow of augmented reality under the real light source. Maybe very difficult, but very interesting. reference: what is the set of images of an object under all possible lighting conditions? 57 58 References [1] Michael Haller, Stephan Drab, and Werner Hartmann. A realtime shadow approach for an Augmented Reality application using shadow volumes. VRST 3, Oct. 1-3, 23, Osaka JAPAN. [2] Cass Eveeritt and Mark J. Kilgard. Practical and robust stenciled shadow volumes for hardware-accelerated rendering. NVIDIA Corporation, March 22. [3] Franklin C. Crow. Shadow algorithms for computer graphics. Proceedings of SIGGRAPH, 1977, pp. 242-248. References [4] Andrew Woo, Pierre Poulin, and Alain Fournier. A survey of shadow algorithms. IEEE Computer Graphics and Applications, Nov. 199, pp. 13-32. [5] Eric Haines, Tomas Möller. Real-time shadows, in Real-time Rendering by Tomas Möller and Eric Haines, A.K. Peters, ISBN 156881112. [6] A. Katayama, Y. Sakagawa, and H.Tamura. A method of shading and shadowing in image-based rendering. Int. Conference on Image Process, vol. 3, pages 26-3. IEEE, 1998. [7] M. D. McCool. Shadow volume reconstruction from depth maps. ACM Transaction on Graphics, 2 59 6

Augmented Reality -- AR Demo Movie 1 Augmented Reality -- AR Demo Movie 2 61 62 Q & A Q & A Session Thank you!????? 63 64