Occlusion Culling ©Yiorgos Chrysanthou, 1999-2001, Anthony Steed, 2004 1 Overview Graphics Pipeline Problems • Speed up techniques Occlusion Culling • Image-based • Object-based 2 What’s wrong with the standard graphics pipeline? It processes every polygon therefore it does not scale • Sometimes polygons than pixels • Pixels are being drawn multiple times According to the statistics, the size of the average 3D model grows more than the processing power 3 Speed Up Techniques Roughly three classes: • Visibility culling – Avoid processing anything that will not be visible in (and thus not contribute to) the final image • Levels of detail – Generate several representations for complex objects are use the simplest that will give adequate visual result from a given viewpoint • Image based rendering – Replace complex geometry with a texture 4 The Visibility Problem Select the (exact?) set of polygons from the model which are visible from a given viewpoint Average number of polygons, visible from a viewpoint, is much smaller than the model size 5 Visibility Culling Avoid rendering polygons or objects not contributing to the final image We have three different cases of non-visible objects: • those outside the view volume (view volume culling) • those which are facing away from the user (back face culling) • those occluded behind other visible objects (occlusion culling) 6 Visibility Culling 7 View Volume Culling If a spatial subdivision exists, it can be used for view volume culling 8 Occlusion Culling Image-space methods • Generally analyse the partially completed image to determine whether or not to render complete objects Object-space methods • Provide methods for determining if sections of the model need rendering due to what can be seen in the view volume A very active topic of research in last 5 years, so there are many, many techniques 9 Image-Based Occlusion Occlusion maps • If you can order the polygons front to back, then the image on the screen tells you areas which are obscured • If, e.g. we find that one quarter of the screen is covered then we need not render anything in that quarter • The problem devolves to finding good occluders, and occludees 10 Testing for Occlusion If the box surrounding a node is not visible then nothing in it is either The faces of the box are projected onto the image plane and tested for occlusion occluder 11 In Image Space Render some set of objects as normal (foreground) Read the image back For other objects • Find bounding box • Test if those pixels covered yet or not 12 In Practice Reading back the image is very slow with current graphics hardware Fortunately recent graphics hardware can do occlusion queries for you • Instead of rendering it tells you whether or not any pixels would be drawn Of course have to make sure that doing the occlusion test is no more expensive that rendering the actual object! 13 Cells and Portals (Teller and Sequin, SIGGRAPH 91) Decompose space into convex cells For each cell, identify its boundary edges into two sets: opaque or portal Precompute visibility among cells During viewing (eg, walkthrough phase), use the precomputed potentially visible polygon set (PVS) of each cell to speed-up rendering 14 Determining Adjacency Information 15 For Each Cell Find Stabbing Tree 16 Compute Cell Visible From Each Cell Linear programming problem: S•L 0, S•R 0, LL RR Find_Visible_Cells(cell C, portal sequence P, visible cell set V) V=V C for each neighbor N of C for each portal p connecting C and N orient p from C to N P’ = P concatenate p if Stabbing_Line(P’) exists then Find_Visible_Cells (N, P’, V) 17 Eye-to-Cell Visibility The eye-to-cell visibility of any observer is a subset of the cell-to-cell visibility for the cell containing the observer A cell is visible if • cell is in VV • all cells along stab tree are in VV • all portals along stab tree are in VV • sightline within VV exists through portals 18 Image Space Cells and Portals (Luebke and Georges, I3D 95) Instead of pre-processing all the PVS calculation, it is possible to use image-space portals to make the computation easier Can be used in a dynamic setting 19 Top View Showing the Recursive Clipping of the View Volume 20 Summary Faster hardware encourages big models Real-time is maintained by visibility culling, level of detail, image-based rendering Occlusion, part of visibility culling relies on either • Being able to identify good occluders (image-based occlusion) • Being able to structure the model to allow analytic solutions (object-based occlusion) 21