10/07/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Last Time Spatial data structures.

Slides:



Advertisements
Similar presentations
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Advanced Light and Shadow Culling Methods Eric Lengyel.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
10/10/02 (c) 2002 University of Wisconsin, CS 559 Last Time Finished viewing: Now you know how to: –Define a region of space that you wish to view – the.
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
Occlusion Culling Fall 2003 Ref: GamasutraGamasutra.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
CSE 381 – Advanced Game Programming Scene Management
Visibility Culling using Hierarchical Occlusion Maps Hansong Zhang, Dinesh Manocha, Tom Hudson, Kenneth E. Hoff III Presented by: Chris Wassenius.
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.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
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 Clipping and Hidden Surfaces CS-184: Computer Graphics Prof. James O’Brien.
Visibility Culling Markus Hadwiger & Andreas Varga.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Hidden Surface Removal
1 Occlusion Culling ©Yiorgos Chrysanthou, , Anthony Steed, 2004.
Afrigraph 2004 Massive model visualization Tutorial A: Part I Rasterization Based Approaches Andreas Dietrich Computer Graphics Group, Saarland University.
Computer Graphics Mirror and Shadows
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
CS-378: Game Technology Lecture #11: Visibility Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
CS 638, Fall 2001 Today Light Mapping (Continued) Bump Mapping with Multi-Texturing Multi-Pass Rendering.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Spatial Partitioning, Visibility and Culling Spring.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
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)
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”
Visibility Culling David Luebke Computer Science Department University of Virginia
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
CS 638, Fall 2001 Today Project Stage 0.5 Environment mapping Light Mapping.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
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.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
03/14/02 (c) 2002 University of Wisconsin, CS559 Last Time Some more visibility (Hidden Surface Removal) algorithms –A-buffer –Scanline –Depth sorting.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
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.
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Implementation II.
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
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
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.
Maths & Technologies for Games Spatial Partitioning 1 CO3303 Week 8-9.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Game Engine Design Quake Engine Presneted by Holmes 2002/12/2.
Hierarchical Occlusion Map Zhang et al SIGGRAPH 98.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Computer Graphics Implementation II
Hidden Surfaces Dr. Scott Schaefer.
Today Visibility Overview Cell-to-Cell Cell-to-Region Eye-To-Region
CSCE 441: Computer Graphics Hidden Surface Removal
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.
© University of Wisconsin, CS559 Fall 2004
CS679 - Fall Copyright Univ. of Wisconsin
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Spatial data structures

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Today Visibility –Portal based –Occlusion culling

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Visibility Visibility algorithms aim to identify everything that will be visible, and not much more Trade off: Application-side time on visibility, vs. hardware time on processing invisible stuff Conservative Visibility: Identify more than what is visible and clean up remaining with a z-buffer The simplest are view-frustum algorithms that eliminate objects outside the view frustum –These algorithms don’t do very well on scenes with high depth complexity, or many objects behind a single pixel –Buildings are a classic case of high depth complexity

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Point-based vs. Cell-based Point-based algorithms compute visibility from a specific point –Which point? –How often must you compute visibility? Cell-based algorithms compute visibility from an entire cell –Union of the stuff visible from each point in the cell –How often must you compute visibility? Which method has a smaller visible set? Which method is suitable for pre-computation?

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Cell-Portal Visibility Keep track of which cell the viewer is in Somehow walk the graph to enumerate all the visible regions Cell-based: Preprocess to identify the potentially visible set (PVS) for each cell –Set may contain whole cells or individual objects Point-based: Traverse the graph at runtime –Granularity can be whole cells, regions, or objects Trend is toward point-based, but cell-based is still very common –Why choose one over the other?

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Potentially Visible Sets PVS: The set of cells/regions/objects/polygons that can be seen from a particular cell –Generally, choose to identify objects that can be seen –Trade-off is memory consumption vs. accurate visibility Computed as a pre-process –Have to have a strategy to manage dynamic objects Used in various ways: –As the only visibility computation - render everything in the PVS for the viewer’s current cell –As a first step - identify regions that are of interest for more accurate run-time algorithms

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Cell-to-Cell PVS Cell A is in cell B’s PVS if there exist a stabbing line that originates on a portal of B and reaches a portal of A –A stabbing line is a line segment intersecting only portals –Neighbor cells are trivially in the PVS I J H G A C BE F D PVS for I contains: B, C, E, F, H, J

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Finding Stabbing Lines In 2D, have to find a line that separates the left edges of the portals from the right edges –A linearly separable set problem solvable in O(n) where n is the number of portals In 3D, more complex because portals are now a sequence of arbitrarily aligned polygons –Put rectangular bounding boxes around each portal and stab those –O(nlogn) algorithm L L LLR R R R

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Cell-To-Region PVS Identify which regions are visible from a cell –Add objects within region to PVS for the cell Key idea is separating planes (or lines in 2D): –Lines going through left edge of one portal and right edge of the other, and vice versa –Potentially visible region is bounded by planes –In 3D, have to find maximal planes (those that make region biggest) This picture should remind you of something (Hint: Think of the left portal as a light source)

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Cell-To-Region (More) If the sequence has multiple portals, find maximal separating lines This work originates from many sources, including shadow computations and mesh generation for radiosity More applications of separating and supporting planes later –Is it OK to use portals that are larger than the actual opening? –Is it OK to use portals that are smaller than the actual opening?

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Properties of PVSs? Almost all of the work is done as a preprocess –At run-time, simply traverse PVS and render contents –Can pre-compute display lists for each cell – fast rendering Most algorithms go further than just Cell-to-Cell PVS –It overestimates by quite a lot – PVS removes 90% of the model, 99.6% is actually invisible, and better visibility gets 98% (Teller 91) Cell-to-Cell PVS is good for dynamic objects –Associate moving objects with the cell they currently occupy –Draw a moving object if the cell it is in is visible

10/07/03CS679 - Fall Copyright Univ. of Wisconsin PVS Problems? Does not take into account the viewer’s location, so reports things that the viewer cannot possibly see Not good at managing dynamic cells/portals –What do you do for doors that can be open or closed? Pre-processing time can be huge –Impacts development of game – turnaround time for changes is large Other algorithms address these things

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Enhancing Cell-to-Anything If the viewer cannot go everywhere in the cell, then cell- based visibility will be too pessimistic One solution is to add special cells that the viewer can see into, but can’t see out of –Put them in places that the viewer cannot go, but can still see Above a certain altitude in outdoor games Below the player’s minimum eye level –Basically implemented as one-way portals The portals only exist in the direction into the cell –Note, doesn’t work if the player should be able to see through a special cell into another cell beyond – why not?

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Runtime Portal Visibility Define a procedure renderCell : –Takes a view frustum and a cell Viewer not necessarily in the cell –Draws the contents of the cell that are in the frustum –For each portal out of the cell, clips the frustum to that portal and recurses with the new frustum and the cell beyond the portal Make sure not to go to the cell you entered Start in the cell containing the viewer, with the full viewing frustum Stop when no more portals intersect the view frustum

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Eye-to-Region Example (1) View

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Eye-to-Region Example (2)

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Implementation Each portal that is passed through contributes some clipping planes to the frustum –If the hardware has enough planes, add them as hardware clipping planes –Or, clip object bounding volumes against them to determine which objects to draw Mirrors are reasonably easy to deal with –Flip the view frustum about the mirror –Add appropriate clipping planes to make sure the right things are drawn A very effective algorithm if the portals are simple –More complex portals can be bounded with screen-space rectangles

10/07/03CS679 - Fall Copyright Univ. of Wisconsin No Cell or Portals? Many scenes do not admit a good cell and portal structure –Scenes without large co-planar polygons to act as blockers or cell walls –Canonical example is a forest – you can’t see through it, but no one leaf is responsible What can we do? –Find occluders and use them to cull geometry –Inverse of cells as portals: Assume all space is open and explicitly look at places where it is blocked

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Using Occluders Assume the occluder is a polygon Form clipping planes using the eye point and the polygon edges –Supporting planes Objects inside all of the occluder’s clipping planes are NOT visible –Occluder itself is a clipping plane –Can use tests similar to view frustum culling, but note that now we trivially accept as soon as the object is outside a clipping plane eye occluder supporting planes

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Simple Occluder Finding Cell based approach Find good sets of occluders for each cell in a preprocess –At run time, use occluders from the viewer’s region What makes a good occluder? –Things that occlude lots of stuff –What properties will a good occluder have?

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Simple Occluder Issues Works best when there are large polygons close to the viewer –Dashboards are a good example For objects, how do you choose their “occlusion shape”? Level designers can add special polygons just to act as occluders –In what situation would you do this? –But should they be drawn? Cell size is clearly important Problem: If an object is partially hidden by one occluder, and partially by another, it is hard to determine whether the entire object is occluded

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Occluder Fusion Small occluders can be merged to generate larger occluders –Level editors are essentially doing this by hand when they place special occluders Key insight: If a potential occluder intersects the occluded region of another, they can be fused –Depth of fused occluder is farthest depth of fused occluders

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Algorithms for Combining Occluders Occlusion Horizons work for 2.5D scenes –Great for cities and the like –An extension exists for relatively simple 3D scenes (eg bridges) Green’s Hierarchical Z-Buffer builds occluders in screen space and does occlusion tests in screen space –Requires special hardware or a software renderer Zhang et.al. Hierarchical Occlusion Maps render occluders into a texture map, then compare objects to the map –Uses existing hardware, but pay for texture creation operations at every frame –Allows for approximate visibility if desired (sometimes don’t draw things that should be) Schaufler et.al. Occluder Fusion builds a spatial data structure of occluded regions

10/07/03CS679 - Fall Copyright Univ. of Wisconsin Todo By Monday, Oct 13, Stage 2 demo