Visibility Culling II: Beyond Cells & Portals David Luebke Computer Science Department University of Virginia

Slides:



Advertisements
Similar presentations
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Advertisements

Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
Advanced Light and Shadow Culling Methods Eric Lengyel.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
Visibility Culling David Luebke Computer Science Department University of Virginia
Visibility in Games Harald Riegler. 2 / 18 Visibility in Games n What do we need it for? u Increase of rendering speed by removing unseen scene data from.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Occlusion Culling Fall 2003 Ref: GamasutraGamasutra.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
Visibility Culling Back face culling View-frustrum culling Detail culling Occlusion culling.
Visibility Culling using Hierarchical Occlusion Maps Hansong Zhang, Dinesh Manocha, Tom Hudson, Kenneth E. Hoff III Presented by: Chris Wassenius.
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Object-Space Visibility Culling Anthony Steed University College London Based upon material presented by Claudio T. Silva at Eurographics 1999 Slides,
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Advanced Data Structures for Games and Graphics Lecture 4
1 From-Point Occlusion Culling From-Point Occlusion Culling Chapter 23.
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
Hidden Surface Removal
1 Occlusion Culling ©Yiorgos Chrysanthou, , Anthony Steed, 2004.
Roger A. Crawfis CIS 781 The Ohio State University
Afrigraph 2004 Massive model visualization Tutorial A: Part I Rasterization Based Approaches Andreas Dietrich Computer Graphics Group, Saarland University.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
10/16/2001CS 638, Fall 2001 Today Visibility –Overview –Cell-to-Cell –Cell-to-Region –Eye-To-Region –Occlusion Culling (maybe)
CSE 381 – Advanced Game Programming Quickhull and GJK.
Culling Techniques “To cull” means “to select from group” In graphics context: do not process data that will not contribute to the final image The “group”
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Visibility Culling David Luebke Computer Science Department University of Virginia
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Visibility Culling III: Image-Space Occlusion David Luebke Computer Science Department University of Virginia
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Visible-Surface Detection Jehee Lee Seoul National University.
Visibility III: Occlusion Queries CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Visibility CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
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.
Implementation II.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
10/07/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Spatial data structures.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Recap: General Occlusion Culling l When cells and portals don’t work… –Trees in a forest –A crowded train station l Need general occlusion culling algorithms:
Coherent Hierarchical Culling: Hardware Occlusion Queries Made Useful Jiri Bittner 1, Michael Wimmer 1, Harald Piringer 2, Werner Purgathofer 1 1 Vienna.
Visibility II CS 446: Real-Time Rendering & Game Technology
Where We Stand At this point we know how to: –Convert points from local to window coordinates –Clip polygons and lines to the view volume –Determine which.
Computer Graphics I, Fall 2010 Implementation II.
DPL2/10/2016 CS 551/651: Final Review David Luebke
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
01/28/09Dinesh Manocha, COMP770 Visibility Computations Visible Surface Determination Visibility Culling.
Hierarchical Occlusion Map Zhang et al SIGGRAPH 98.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
Occlusion Culling David Luebke University of Virginia.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia Visibility Calculations and Occlusion Culling.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics Implementation II
Today Visibility Overview Cell-to-Cell Cell-to-Region Eye-To-Region
Implementation II Ed Angel Professor Emeritus of Computer Science
Conservative Visibility Preprocessing using Extended Projections Frédo Durand, George Drettakis, Joëlle Thollot and Claude Puech iMAGIS-GRAVIR/IMAG-INRIA.
CS 551 / 645: Introductory Computer Graphics
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Visibility Culling II: Beyond Cells & Portals David Luebke Computer Science Department University of Virginia

D2 Review: Cells & Portals Idea:Idea: –Cells form the basic unit of PVS –Create an adjacency graph –Create an adjacency graph of cells –Starting with cell containing eyepoint, traverse graph, rendering visible cells –A cell is only visible if it can be seen through a sequence of portals So cell visibility reduces to testing portal sequences for a line of sight… So cell visibility reduces to testing portal sequences for a line of sight…

D3 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA

D4 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA

D5 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA

D6 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA

D7 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA

D8 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA ? ?

D9 Cells & Portals: View-Dependent Solution A D H F CB E G H BCDFG EA X X

D10 Cells & Portals: View-Independent Solution View-independent solution: find all cells a particular cell could possibly see: View-independent solution: find all cells a particular cell could possibly see: C can only see A, D, E, and H A D H F CB E G A D H E

D11 Cells & Portals: View-Independent Solution View-independent solution: find all cells a particular cell could possibly see: View-independent solution: find all cells a particular cell could possibly see: H will never see F A D H F CB E G A D CB E G

D12 Review: Cells and Portals Questions:Questions: – How can we detect whether a given cell is visible from a given viewpoint? – How can we detect view-independent visibility between cells? The key insight :The key insight : –These problems reduce to eye-portal and portal-portal visibility

D13 Cells and Portals Luebke (1995): view-dependent onlyLuebke (1995): view-dependent only –Eye-portal visibility determined by intersecting portal cull boxes –No preprocess (integrate w/ modeling) –Quick, simple hack –Public-domain library: pfportals.cs.virginia.edu

D14 pfPortals Algorithm Depth-first adjacency graph traversalDepth-first adjacency graph traversal –Render cell containing viewer –Treat portals as special polygons If portal is visible, render adjacent cell If portal is visible, render adjacent cell But clip to boundaries of portal!But clip to boundaries of portal! Recursively check portals in that cell against new clip boundaries (and render) Recursively check portals in that cell against new clip boundaries (and render) –Each visible portal sequence amounts to a series of nested portal boundaries Kept implicitly on recursion stack Kept implicitly on recursion stack

D15 pfPortals Algorithm Recursively rendering cells while clipping to portal boundaries not newRecursively rendering cells while clipping to portal boundaries not new –Visible-surface algorithm (Jones 1971): general polygon-polygon clipping Elegant, expensive, complicated Elegant, expensive, complicated –Conservative overestimate (pfPortals): use portal’s cull box Cull box = x-y screenspace bounding box Cull box = x-y screenspace bounding box Cheap to compute, very cheap (constant time) to intersect Cheap to compute, very cheap (constant time) to intersect

D16 pfPortals Algorithm How badly does the cull box approximation overestimate PVS? How badly does the cull box approximation overestimate PVS? –Not much for most architectural scenes Note: Can implement mirrors as portals with an extra transformation!Note: Can implement mirrors as portals with an extra transformation! –Some clipping & Z-buffering issues –Must limit recursion

D17 Cells and Portals: Details Usually separate model into occluders and detail objectsUsually separate model into occluders and detail objects –Occluders: walls, floors –Detail objects: desks, chairs, pencils –Cell creation process only accounts for occluders ( Why? ) pfPortals: find detail object visibility through portal sequences at run timepfPortals: find detail object visibility through portal sequences at run time Teller: also precompute into PVSTeller: also precompute into PVS

D18 Why View-Independent? If view-dependent techniques can often calculate a reasonable PVS fast enough, why bother with view-independent solutions? If view-dependent techniques can often calculate a reasonable PVS fast enough, why bother with view-independent solutions? One good answer: smart prefetchingOne good answer: smart prefetching –Soda Hall walkthrough (Funkhouser) Whole model doesn’t fit in memory Whole model doesn’t fit in memory Use Teller stab trees to load in only cells that might be visible Use Teller stab trees to load in only cells that might be visible

D19 Creating Cells and Portals Given a model, how might you extract the cells and portals? Given a model, how might you extract the cells and portals? –Airey: k-D tree (axis-aligned boxes) –Teller: BSP tree (general convex cells) –Luebke: modeler (any cells at all) Problems and issuesProblems and issues –Running time –Free cells –Intra-wall cells

D20 Cells and Portals: Discussion Good solution for most architectural or urban modelsGood solution for most architectural or urban models –Use the simplest algorithm that suffices for your needs: pfPortals-style algorithm: view-dependent solution, reasonably tight PVS, no preprocess necessary (except partition) pfPortals-style algorithm: view-dependent solution, reasonably tight PVS, no preprocess necessary (except partition) Teller-style algorithm: tighter PVS, somewhat more complex, can provide view-independent solution for prefetching Teller-style algorithm: tighter PVS, somewhat more complex, can provide view-independent solution for prefetching

D21 Cells and Portals: Discussion Public-domain code I’m aware of:Public-domain code I’m aware of: –pfPortals: A very simple set of Performer callbacks that implements cull-box portal culling A very simple set of Performer callbacks that implements cull-box portal culling –pfWalkthru: Includes code to extract cells and portals Includes code to extract cells and portals –Game engine sites Lots of “level builders” and “level compilers” Lots of “level builders” and “level compilers” Treat these with a grain of salt Treat these with a grain of salt

D22 General Occlusion Culling When cells and portals don’t work…When cells and portals don’t work… –Trees in a forest –A crowded train station Need general occlusion culling algorithms:Need general occlusion culling algorithms: –Aggregate occlusion –Dynamic scenes –Non-polygonal scenes

D23 General Occlusion Culling I’ll discuss three algorithms:I’ll discuss three algorithms: –Loose front-to-back sorting –Hierarchical Z-Buffer Ned Greene, SIGGRAPH 93 Ned Greene, SIGGRAPH 93 –Hierarchical Occlusion Maps Hansong Zhang, SIGGRAPH 97 Hansong Zhang, SIGGRAPH 97 I’ll also describe current hardware supportI’ll also describe current hardware support

D24 Loose Front-To-Back Sorting Can sort your geometry in roughly front-to- back order, e.g. by:Can sort your geometry in roughly front-to- back order, e.g. by: –Using an octree/BSP tree –Sorting centroids or near points of bounding volumes Why would this help? Why would this help? –A: Early rejection helps whole fragment pipeline Why might this be hard? Why might this be hard? –A: could conflict with sorting by render state

D25 Image-Space Occlusion Culling Most general occlusion culling algorithms use an image-space approachMost general occlusion culling algorithms use an image-space approach Idea: solve visibility in 2D, on the image planeIdea: solve visibility in 2D, on the image plane

D26 Hierarchical Z-Buffer Replace Z-buffer with a Z-pyramidReplace Z-buffer with a Z-pyramid –Lowest level: full-resolution Z-buffer –Higher levels: each pixel represents the maximum depth of the four pixels “underneath” it Basic idea: hierarchical rasterization of the polygon, with early termination where polygon is occludedBasic idea: hierarchical rasterization of the polygon, with early termination where polygon is occluded

D27 Hierarchical Z-Buffer Idea: test polygon against highest level firstIdea: test polygon against highest level first –If polygon is further than distance recorded in pixel, stop—it’s occluded –If polygon is closer, recursively check against next lower level –If polygon is visible at lowest level, set new distance value and propagate up

D28 Hierarchical Z-Buffer Z-pyramid exploits image-space coherence :Z-pyramid exploits image-space coherence : –Polygon occluded in a pixel is probably occluded in nearby pixels HZB also exploits object-space coherenceHZB also exploits object-space coherence –Polygons near an occluded polygon are probably occluded

D29 Hierarchical Z-Buffer Exploiting object-space coherence:Exploiting object-space coherence: –Subdivide scene with an octree –All geometry in an octree node is contained by a cube –Before rendering the contents of a node, “render” the faces of its cube (i.e., query the Z-pyramid) –If cube faces are occluded, ignore the entire node

D30 Hierarchical Z-Buffer HZB can exploit temporal coherenceHZB can exploit temporal coherence –Most polygons affecting the Z-buffer last frame will affect Z-buffer this frame –HZB also operates at max efficiency when Z-pyramid already built So start each frame by rendering octree nodes visible last frameSo start each frame by rendering octree nodes visible last frame

D31 Hierarchical Z-Buffer: Discussion HZB needs hardware support to be really competitiveHZB needs hardware support to be really competitive Hardware vendors haven’t entirely bought in:Hardware vendors haven’t entirely bought in: –Z-pyramid (and hierarchies in general) unfriendly to hardware –Unpredictable Z-query times generate bubbles in rendering pipe But there is a promising trend…But there is a promising trend…

D32 Hierarchical Z-Buffer Recent hardware supports Z-query operationRecent hardware supports Z-query operation –Allows systems to exploit: Object-space coherence (bounding boxes) Object-space coherence (bounding boxes) Temporal coherence (last-rendered list) Temporal coherence (last-rendered list) –Examples in OpenGL: HP_OCCLUSION_QUERY HP_OCCLUSION_QUERY NV_OCCLUSION_QUERY NV_OCCLUSION_QUERY Go to NVIDIA occlusion presentation… Go to NVIDIA occlusion presentation… –An aside: applies to cell-portal culling!