© 2004 Tomas Akenine-Möller1 Shadow Generation Hardware Vision day at DTU 2004 Tomas Akenine-Möller Lund University.

Slides:



Advertisements
Similar presentations
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Advanced Light and Shadow Culling Methods Eric Lengyel.
Optimized Stencil Shadow Volumes
Optimized Stencil Shadow Volumes
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Computer Graphics methods
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Results / Compared to Relief Mapping It does not scale linearly with screen coverage as does the other techniques. However, for larger displacements, it.
Shadow Volumes Revisited Stefan Roettger Alexander Irion Thomas Ertl University of Stuttgart, VIS Group.
1 Dr. Scott Schaefer Shadows. 2/40 Shadows Shadows provide clues about depth Make scenes appear more realistic.
Hardware Support for Non-photorealistic Rendering: A summary Paper last updated by Ramesh Raskar February 2002 Presented by Rachel Probert.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Computer Graphics Hardware Acceleration for Embedded Level Systems Brian Murray
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
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
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.
Status – Week 231 Victor Moya. Summary Primitive Assembly Primitive Assembly Clipping triangle rejection. Clipping triangle rejection. Rasterization.
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University.
Z-Buffer Optimizations Patrick Cozzi Analytical Graphics, Inc.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
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.
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.
Polygon Scan Conversion and Z-Buffering
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
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.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
MIT EECS 6.837, Durand and Cutler Real-Time Shadows.
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
CAP4730: Computational Structures in Computer Graphics
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Hidden Surface Removal
Implementation II.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Computer Graphics I, Fall 2010 Implementation II.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
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.
Hierarchical Occlusion Map Zhang et al SIGGRAPH 98.
Non-Photorealistic Rendering FORMS. Model dependent Threshold dependent View dependent Outline form of the object Interior form of the object Boundary.
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.
Real-Time Rendering Shadow Volumes
Hybrid Ray Tracing of Massive Models
Jim X. Chen George Mason University
Conservative Visibility Preprocessing using Extended Projections Frédo Durand, George Drettakis, Joëlle Thollot and Claude Puech iMAGIS-GRAVIR/IMAG-INRIA.
Lecture 13 Clipping & Scan Conversion
A Hierarchical Shadow Volume Algorithm
Frame Buffer Applications
Presentation transcript:

© 2004 Tomas Akenine-Möller1 Shadow Generation Hardware Vision day at DTU 2004 Tomas Akenine-Möller Lund University

© 2004 Tomas Akenine-Möller2 Outline of my presentation Quick review of shadow volume algorithm –Zfail –Zpass A hierarchical shadow volume algorithm –Overall idea –Efficient hardware implementation

© 2004 Tomas Akenine-Möller3 The shadow volume algorithm Crow's (1977) idea, shadow volumes define volumes of space in shadow. From the School of Leonardo Da Vinci

© 2004 Tomas Akenine-Möller4 Shadow volume concept Create volumes of space in shadow from each polygon in light. Each triangle creates 3 projecting quads

© 2004 Tomas Akenine-Möller5 Using the volume To test a point, count the number of polygons between it and the eye. If we look through more frontfacing than backfacing polygons, then in shadow. frontfacing backfacing

© 2004 Tomas Akenine-Möller6 Eye Location Problem If the eye location is inside one or more shadow volumes, count is wrong. Eye problem fixed by clearing stencil buffer to # of volumes eye is inside.

© 2004 Tomas Akenine-Möller7 Frustum Location Problem Frustum’s near (hither) plane overlaps a shadow volume, frontface counts missed Some form of capping is needed to make the shadow volume whole again (not trivial, nor robust)

© 2004 Tomas Akenine-Möller8 Solution: Count Beyond Surface “Z-fail-algorithm” Render to stencil only when shadow volume Z >= stored Z! must cap ends of shadow volumes (or project to infinity, w=0 for vertices)

© 2004 Tomas Akenine-Möller9 Why This Works (f - b) in front of plane = (b - f) in back 2-2 = 0 2 = 2 1 = 2-1 red - violet violet - red

© 2004 Tomas Akenine-Möller10 Merging shadow volumes Edge shared by two polygons facing the light creates front and backfacing quad. This interior edge makes two quads, which cancel out Instead, use only potential silhouette edges as seen from the light:

© 2004 Tomas Akenine-Möller11 Z-pass by example What we have... What we wnat...

© 2004 Tomas Akenine-Möller12 Z-fail by example

© 2004 Tomas Akenine-Möller13 Are there any work on accelerating shadow volume rendering? When we started with this project, NVIDIA’s UltraShadow technique was the only existing algorithm UltraShadows – two things: –Extra pipes... –Depth bounds Check out EGSR 2004 – several interesting shadow papers: –Lloyd et al, ”CC Shadow Volumes” –Chan and Durand: Hybrid Shadow map and volumes

© 2004 Tomas Akenine-Möller14 A Hierarchical Shadow Volume Algorithm Motivation: fillrate problem with shadow volume rendering Correct result:

© 2004 Tomas Akenine-Möller15 Only ”dark shadow pixels” require per-pixel processing...

© 2004 Tomas Akenine-Möller16 Low-resolution version shadows (8x8 pixels)

© 2004 Tomas Akenine-Möller17 Green tiles may contain a shadow boundary - others are correct

© 2004 Tomas Akenine-Möller18 Low-res (gray) + per-pixel computed boundaries (dark)

© 2004 Tomas Akenine-Möller19 How to detect boundary tiles? 8 8 Z max Z min Axis-aligned screen- space bounding box of a tile { Fundamental observation: A tile can contain a shadow boundary, iff its bounding box is intersected by at least one shadow volume triangle.

© 2004 Tomas Akenine-Möller20 Low-resolution rasterizer (for each tile) Delay Shadow volume Temp boundaryTemp stencil Per-pixel rasterization Copy to 2-level stencil Low-resolution rasterizer sv polys (wait until end of sv) Boundary? sv polys Update 2-level stencil YesNo

© 2004 Tomas Akenine-Möller21 Two-pass rasterization 1.Low-res rasterization & boundary test classifications ready only when entire shadow volume processed 2.Wait by using a delay stream stores compressed vertices and render states 3.Per-pixel rasterization of boundary tiles skip rasterization to tiles that are fully in shadow or fully lit, because the results are already known

© 2004 Tomas Akenine-Möller22 How to detect begin/end of shadow volume? You will have to tell the algorithm about this Send a marker down the pipeline –Beginning of shadow volume –End of shadow volume –Need new API calls E.g. glBeginShadowVolume() glEndShadowVolume()

© 2004 Tomas Akenine-Möller23 Stencil buffer updates Could write all 64 values per tile –Bandwidth problem  Two-level stencil buffer saves the day –[S min, S max ] per tile –Always test the higher level first! –Often no need to validate per-pixel values

© 2004 Tomas Akenine-Möller24 Speeding up Overlapping Shadow Volumes Several shadow volumes per light source The shadow area grows monotonically when more shadow volumes added –If tile already in shadow, skip rasterization No need to rasterize shadow twice!

© 2004 Tomas Akenine-Möller25 New hardware New on-chip buffers –Two-level stencil buffer beneficial for other computations too –Tile classification buffer (cache) need multiple buffers for pipelined operation allocate from external memory, use through cache Delay stream (if not already in there) New logic –Low-res rasterization (trivial) –Bounding box intersection (must be robust!)

© 2004 Tomas Akenine-Möller26 Algorithm animation Show animation

© 2004 Tomas Akenine-Möller27 Results

© 2004 Tomas Akenine-Möller28 The end Questions? Publication: Timo Aila, and Tomas Akenine-Möller, “A Hierarchical Shadow Volume Algorithm”, accepted for Graphics Hardware 2004.

© 2004 Tomas Akenine-Möller29 Misc notes A highly tesselated sphere will not add much more BW usage than a sphere with few triangles