Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering Cass Everitt and Mark J. Kilgard Speaker: Alvin Date: 5/28/2003 NVIDIA.

Slides:



Advertisements
Similar presentations
An Optimized Soft Shadow Volume Algorithm with Real-Time Performance Ulf Assarsson 1, Michael Dougherty 2, Michael Mounier 2, and Tomas Akenine-Möller.
Advertisements

Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Optimized Stencil Shadow Volumes
Optimized Stencil Shadow Volumes
Game Programming 09 OGRE3D Lighting/shadow in Action
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Computer Graphics methods
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Two Methods for Fast Ray-Cast Ambient Occlusion Samuli Laine and Tero Karras NVIDIA Research.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Shadow Rendering Techniques A point is in the shadow of a light source if it can not be “seen” by the light source, i.e. the line segment that connects.
9/25/2001CS 638, Fall 2001 Today Shadow Volume Algorithms Vertex and Pixel Shaders.
Projection Matrix Tricks Eric Lengyel Outline  Projection Matrix Internals  Infinite Projection Matrix  Depth Modification  Oblique Near Clipping.
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.
黃聰賢. Light Position Mesh Polygon Shadow Polygon  Clear color buffer and stencil buffer  Render the scene with ambient only.
A Survey of Real-time Soft Shadows Algorithms Speaker: Alvin Date: 2003/7/23 EUROGRAPHICS 2003 J.-M. Hasenfratz, M. Lapierre, N. Holzschuch and F.X. Sillion.
A Real-Time Soft Shadow Volume Algorithm DTU Vision days Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology Sweden
Shadow Silhouette Maps Pradeep Sen Mike Cammarano Pat Hanrahan Stanford University Speaker: Alvin Date: 8/24/2003 SIGGRAPH 2003.
Shadow Volumes on Programmable Graphics Hardware Speaker: Alvin Date: 2003/11/3 EUROGRAPHICS 2003.
1 Dynamic Shadows and Lighting for Walkthrus of Large Models Brandon Lloyd COMP 258 December 2002.
Perspective Shadow Maps Marc Stamminger and George Drettakis Speaker: Alvin Date: 5/28/2003 SIGGRAPH 2002.
Shadow Algorithms Gerald Matzka Computer Science Seminar.
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University.
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.
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.
Hidden Surface Removal
Creating Reflections and Shadows Using Stencil Buffers Mark J. Kilgard NVIDIA Corporation.
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.
CS 638, Fall 2001 Today Light Mapping (Continued) Bump Mapping with Multi-Texturing Multi-Pass Rendering.
CSE 381 – Advanced Game Programming Basic 3D Graphics
1 Shadows © Jeff Parker, 2011 " What is written without effort is in general read without pleasure.” -- Samuel Johnson.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
CHAPTER 11 Shadows © 2008 Cengage Learning EMEA. LEARNING OBJECTIVES In this chapter you will learn about: – –Shadow rendering algorithms – –Blinn’s shadow.
MIT EECS 6.837, Durand and Cutler Real-Time Shadows.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
1 10/24/ :01 UML Graphics II Shadows Session 4.
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.
CS-378: Game Technology Lecture #8: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Hidden Surface Removal
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
Computer graphics & visualization Shadows / Transparency.
OpenGL Shadow. Content Shadowing using Stencil Buffer Shadowing using Projective Texture Shadow map Shadow volume.
Advanced Programmable Shading: Beyond Per-vertex and Per-pixel Shading.
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.
Stencil Shadows Garrett Weng. What are stencil shadows? Also known as shadow volumes Relies on use of the stencil buffer Create volumes of the shadows.
Graphics, Modeling, and Textures Computer Game Design and Development.
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.
CENG 477 Introduction to Computer Graphics
Real-Time Rendering Shadow Volumes
Jim X. Chen George Mason University
Graphics, Modeling, and Textures
UMBC Graphics for Games
A Hierarchical Shadow Volume Algorithm
Texture and Shadow Mapping
OpenGL Shadow.
Frame Buffer Applications
Presentation transcript:

Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering Cass Everitt and Mark J. Kilgard Speaker: Alvin Date: 5/28/2003 NVIDIA Corporation 2002

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Shadow Volume A shadow volume is simply the half-space defined by a light source and a occluder.

Shadow Volume

Shadow Volume Example

Shadow Volume Advantages Omni-directional approach Automatic self-shadowing Window-space shadow determination Required stencil buffer broadly supported today

Shadow Volume Disadvantages Ideal light sources only Lack soft shadow Requires polygonal models with connectivity Silhouette computations are required Inherently multi-pass algorithm Consumes lots of GPU fill rate

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Stenciled Shadow Volume (Zpass) Render scene with only ambient and emissive lighting contribution, and initialize depth buffer PS: Depth values indicate the closest visible fragments Use a stencil enter/leave counting approach Draw shadow volume twice using face culling 1st pass: render front faces and increment when depth test passes 2nd pass: render back faces and decrement when depth test passes Don ’ t update depth or color Afterward, pixel ’ s stencil is non-zero if pixel in shadow, and zero if illuminated

Visualizing the Stencil Buffer

Counting

Illuminated Object

Shadowed Object

Visualizing the Stencil Buffer

Near Clip Plane Problem

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Zfail Approach Render scene with only ambient and emissive lighting contribution, and initialize depth buffer PS: 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 Afterward, pixel ’ s stencil is non-zero if pixel in shadow, and zero if illuminated

Illuminated Object

Shadowed Object

Far Clip Plane Problem

The Solution for Far Clip Plane Problem

Standard glFrustum Projection Matrix

glFrustum Matrix for Far Plane is Moved to Infinity

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Robust Shadow Volumes Use Zfail Stenciling Approach Must render geometry to close shadow volume extrusion on the model and at infinity. Use the P inf Projection Matrix No worries about far plane clipping. Losses some depth buffer precision. Draw the infinite vertices of the shadow volume using homogeneous coordinates (w=0)

Infinite Shadow Volume Polygons To be robust, the shadow volume geometry must be closed, even at infinity. Three sets of polygons close the shadow volume: 1. Possible silhouette edges extruded to infinity away from the light. 2. All of the occluder ’ s back-facing triangles projected away from the light to infinity. 3. All of the occluder ’ s front-facing triangles. We assume the object vertices and light position are homogeneous coordinates Where w ≡ 0.

Possible Silhouette Edges Assuming: 1. A and B are vertices of an occluder model ’ s possible silhouette edge L is the light position. For all A and B on silhouette edges of the occluder model, render the quad. (next page) What is a possible silhouette edge? A edge shared by two triangles in a model where one faces L while the other faces away L.

Possible Silhouette Edges Quad

Examples of Possible Silhouette Edges

Occluder ’ s Back-Facing Triangles Assuming A, B, and C are each vertices of occluder model ’ s back-facing triangles. These vertices are effectively directions. (w=0)

Occluder ’ s Front-Facing Triangles Assuming A, B, and C are each vertices of occluder model ’ s front front-facing triangles.

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Requirements Models must be composed of triangles only (avoiding non-planar polygons) Models must be closed (2-manifold) and have a consistent winding order Homogeneous object coordinates are permitted, assuming w ≡ 0 Ideal light sources only Directional or positional, assuming w ≡ 0

Requirements Connectivity information for occluding models must be available. So silhouette edges positions can be determined at shadow volume construction time. Projection matrix must be perspective. Render must guarantee “ watertight ” rasterization. No double hitting pixels at shared polygon edges. No missed pixels at shared polygon edges.

Requirements Enough stencil bits Rendering features provided by OpenGL 1.0 or DirectX 6

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Result

Result

Result

Result

Result

Result

Result

Outline Shadow Volume Stenciled Shadow Volume (Zpass) Zfail Approach Robust Shadow Volumes Requirements Result Conclusion

Robust Shadow Volumes Use Zfail stenciling approach Use the P inf projection matrix 3. infinite shadow volume polygons 3. Draw the infinite shadow volume polygons 4. No near clip plane problem or far clip plane problem. 5. Only requires hardware functionality that is ubiquitous today.