Visibility Culling 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.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Collision Detection and Resolution Zhi Yuan Course: Introduction to Game Development 11/28/
Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.
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.
AreaPortal Visibility By Filami. Objectives Practice the techniques of visibility determination using Area Portals; Develop an experimental application.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
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,
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
Tomas Mőller © 2000 Speed-up Techniques for Real-Time Rendering or “What makes your real-time video game fly” Tomas Möller Chalmers University of Technology,
Advanced Data Structures for Games and Graphics Lecture 4
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
1 From-Point Occlusion Culling From-Point Occlusion Culling Chapter 23.
Fall 2006 revised1 Frustum Culling in OpenGL Ref: MarkMoley.com.
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.
Ray Space Factorization for From-Region Visibility Authors: Tommer Leyvand, Olga Sorkine, Daniel Cohen-Or Presenter: Alexandre Mattos.
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.
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 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 Culling II: Beyond Cells & Portals David Luebke Computer Science Department University of Virginia
Visibility CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
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.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
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.
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.
Maths & Technologies for Games Spatial Partitioning 2
Maths & Technologies for Games Spatial Partitioning 1 CO3303 Week 8-9.
DPL2/10/2016 CS 551/651: Final Review David Luebke
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Game Engine Design Quake Engine Presneted by Holmes 2002/12/2.
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
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Occlusion Culling David Luebke University of Virginia.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia Visibility Calculations and Occlusion Culling.
Visibility-Driven View Cell Construction Oliver Mattausch, Jiří Bittner, Michael Wimmer Institute of Computer Graphics and Algorithms Vienna University.
Bounding Volume Hierarchies and Spatial Partitioning
Frustum Culling in OpenGL
Bounding Volume Hierarchies and Spatial Partitioning
Today Visibility Overview Cell-to-Cell Cell-to-Region Eye-To-Region
Parts of these slides are based on
CSCE 441: Computer Graphics Hidden Surface Removal
CMSC 635 Ray Tracing.
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
Presentation transcript:

Visibility Culling David Luebke Computer Science Department University of Virginia

D2 Motivation Like most other rendering acceleration techniques, the goal is to avoid rendering redundant geometryLike most other rendering acceleration techniques, the goal is to avoid rendering redundant geometry The basic idea: don’t render what can’t be seenThe basic idea: don’t render what can’t be seen –Off-screen: view-frustum culling –Occluded by other objects: occlusion culling

D3 Motivation The obvious question: why bother?The obvious question: why bother? –Off-screen geometry: solved by clipping –Occluded geometry: solved by Z-buffer The (obvious) answer: efficiencyThe (obvious) answer: efficiency –Clipping and Z-buffering take time linear to the number of primitives

D4 The Goal Our goal: quickly eliminate large portions of the scene which will not be visible in the final imageOur goal: quickly eliminate large portions of the scene which will not be visible in the final image –Not the exact visibility solution, but a quick-and-dirty conservative estimate of which primitives might be visible Z-buffer& clip this for the exact solution Z-buffer& clip this for the exact solution –This conservative estimate is called the potentially visible set –This conservative estimate is called the potentially visible set or PVS

D5 Visibility Culling The remainder of this talk will cover:The remainder of this talk will cover: –View-frustum culling (briefly) –Occlusion culling in architectural environments –General occlusion culling

D6 View-Frustum Culling An old idea (Clark 76):An old idea (Clark 76): –Organize primitives into clumps –Before rendering the primitives in a clump, test a bounding volume against the view frustum If the clump is entirely outside the view frustum, don’t render any of the primitives If the clump is entirely outside the view frustum, don’t render any of the primitives If the clump intersects the view frustum, add to PVS and render normally If the clump intersects the view frustum, add to PVS and render normally

D7 Efficient View-Frustum Culling How big should the clumps be? How big should the clumps be? –Choose minimum size so: cost testing bounding volume << cost clipping primitives –Organize clumps into a hierarchy of bounding volumes for more efficient testing If a clump is entirely outside or entirely inside view frustum, no need to test its children If a clump is entirely outside or entirely inside view frustum, no need to test its children

D8 Efficient View-Frustum Culling What shape should bounding volumes be? What shape should bounding volumes be? –Spheres and axis-aligned bounding boxes: simple to calculate, cheap to test – Oriented bounding boxes converge asymptotically faster in theory –Lots of other volumes have been proposed, but most people still use spheres or AABBs.

D9 Cells & Portals Goal: walk through architectural models (buildings, cities, catacombs)Goal: walk through architectural models (buildings, cities, catacombs) These divide naturally into cellsThese divide naturally into cells –Rooms, alcoves, corridors… Transparent portals connect cellsTransparent portals connect cells –Doorways, entrances, windows… Notice: cells only see other cells through portalsNotice: cells only see other cells through portals

D10 Cells & Portals An example:An example:

D11 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…

D12 Cells & Portals A D H F CB E G H BCDFG EA

D13 Cells & Portals A D H F CB E G H BCDFG EA

D14 Cells & Portals A D H F CB E G H BCDFG EA

D15 Cells & Portals A D H F CB E G H BCDFG EA

D16 Cells & Portals A D H F CB E G H BCDFG EA

D17 Cells & Portals A D H F CB E G H BCDFG EA ? ?

D18 Cells & Portals A D H F CB E G H BCDFG EA X X

D19 Cells & Portals 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

D20 Cells & Portals 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

D21 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

D22 Cells and Portals Airey (1990): view-independent onlyAirey (1990): view-independent only –Portal-portal visibility determined by ray-casting Non-conservative portal-portal test resulted in occasional errors in PVS Non-conservative portal-portal test resulted in occasional errors in PVS –Slow preprocess –Order-of-magnitude speedups

D23 Cells and Portals Teller (1993): view-independent + view-dependentTeller (1993): view-independent + view-dependent –Portal-portal visibility calculated by line stabbing using linear program Cell-cell visibility stored in stab trees Cell-cell visibility stored in stab trees View-dependent eye-portal visibility stage further refines PVS at run time View-dependent eye-portal visibility stage further refines PVS at run time –Slow preprocess –Elegant, exact scheme

D24 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

D25 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

D26 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

D27 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

D28 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

D29 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

D30 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

D31 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

D32 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