culling techniques

40
Culling Techniques 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” is the entire scene, and the selection is a subset of the scene that we do not consider to contribute

Upload: inez

Post on 21-Mar-2016

43 views

Category:

Documents


12 download

DESCRIPTION

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” is the entire scene, and the selection is a subset of the scene that we do not consider to contribute. Culling: Overview. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Culling Techniques

Culling TechniquesCulling Techniques“To cull” means “to select from group” In graphics context: do not process data

that will not contribute to the final imageThe “group” is the entire scene, and the

selection is a subset of the scene that we do not consider to contribute

Page 2: Culling Techniques

Culling: OverviewCulling: OverviewBackface cullingHierarchical view-frustum cullingPortal cullingDetail cullingOcclusion culling

Page 3: Culling Techniques

Culling examplesCulling examples

view frustum detail

backface

portal occlusion

Page 4: Culling Techniques

Backface CullingBackface CullingSimple technique to discard polygons

that faces away from the viewerCan be used for:

– closed surface (example: sphere)– or whenever we know that the backfaces never

should be seen (example: walls in a room)Two methods (screen space, eye space)Which stages benefits? Rasterizer, but

also Geometry (where test is done)

Page 5: Culling Techniques

Backface culling (cont’d)Backface culling (cont’d)Often implemented for you in the APIOpenGL: glCullFace(GL_BACK);How to determine what faces away?First, must have consistently oriented

polygons, e.g., counterclockwise

0

1

2

front facing01

2

back facing

Page 6: Culling Techniques

How to cull backfacesHow to cull backfaces

screen space

1

0

2

front

01

2

back

front

backeye

eye space

Page 7: Culling Techniques

View-Frustum CullingView-Frustum CullingBound every “natural” group of primitives

by a simple volume (e.g., sphere, box) If a bounding volume (BV) is outside the

view frustum, then the entire contents of that BV is also outside (not visible)

Avoid further processing of such BV’s and their containing geometry

Page 8: Culling Techniques

Can we accelerate VF culling Can we accelerate VF culling further?further?Do what we always do in graphics…Use a hierarchical approach, e.g,

the scene graphWhich stages benefits?

– Geometry and Rasterizer – Bus between CPU and Geometry

Page 9: Culling Techniques

Example of Hierarchical View Example of Hierarchical View Frustum CullingFrustum Culling

root

camera

Page 10: Culling Techniques

Culling examplesCulling examples

view frustum detail

backface

portal occlusion

Page 11: Culling Techniques

Cells and PortalsCells and Portals

[Airey90, Teller91, Luebke95]

Page 12: Culling Techniques

Cells and PortalsCells and PortalsFor each cell, create a list (set) of

potentially visible objects (or PVS) from any viewpoint in the cell.

During run-time:– Determine cell of the current eye-point and gets

its PVS.– Cull down this list by clipping to the viewing

frustum.– Render this set.

Page 13: Culling Techniques

Determining the PVSDetermining the PVS Two options:

– Static (preprocessing stage) Cell-to-cell visibility Cell-to-region visibility Cell-to-object visibility Leads to very large and complicated data structures.

– Dynamic (dependent on the viewing frustum) Eye-to-cell Eye-to-region Eye-object

Page 14: Culling Techniques

CellsCells andand PortalsPortals(Teller and Sequin, SIG 91)(Teller and Sequin, SIG 91) Decompose space into convex cellsFor each cell, identify its boundary edges

into two sets: opaque or portalPre-compute visibility among cellsDuring viewing (e.g., walkthrough phase),

use the pre-computed potentially visible polygon set (PVS) of each cell to speed-up rendering

Page 15: Culling Techniques

Determining Adjacent InformationDetermining Adjacent Information

Page 16: Culling Techniques

Cell-to-Cell VisibilityCell-to-Cell VisibilityFor Each Cell Find Stabbing Tree

Page 17: Culling Techniques

Compute Compute CCells ells VisibleVisible From From EachEach CCellell

S•L 0, L LS•R 0, R RLinear programming problem:

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)

Page 18: Culling Techniques

Cell-to-Region VisibilityCell-to-Region Visibility

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

The cell-to-region visibility is a subset of the cell-to-cell visibility for the current cell.

Page 19: Culling Techniques

Cell-to-Region VisibilityCell-to-Region VisibilityThe cell-to-object visibility is a list of

those objects that are in the visible regions.

Page 20: Culling Techniques

Image Space Cells and PortalsImage Space Cells and Portals ((Luebke and Georges, I3D 95)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

Page 21: Culling Techniques

Top View Showing Top View Showing tthe Recursivehe Recursive Clipping Clipping of the View Volumeof the View Volume

Page 22: Culling Techniques

Portal CullingPortal CullingImages courtesy of David P. Luebke and Chris Georges

Average: culled 20-50% of the polys in view Speedup: from slightly better to 10 times

Page 23: Culling Techniques

Portal culling examplePortal culling example In a building from above Circles are objects to be rendered

Page 24: Culling Techniques

Portal Culling AlgorithmPortal Culling Algorithm

Divide into cells with portals (build graph)For each frame:

– Locate cell of viewer and init 2D AABB to whole screen

– * Render current cell with VF cull w.r.t. AABB– Traverse to closest cells (through portals)– Intersection of AABB & AABB of traversed portal– Goto *

Page 25: Culling Techniques

Portal overestimationPortal overestimation

To simplify:

actual portal overestimated portal

Page 26: Culling Techniques

Portal Culling AlgorithmPortal Culling AlgorithmWhen to exit:

– When the current AABB is empty– When we do not have enough time to render a

cell (“far away” from the viewer)Also: mark rendered objectsWhich stages benefits?

– Geometry, Rasterizer, and BusSource (for Performer-based pfPortal):

http://www.cs.virginia.edu/~luebke/

Page 27: Culling Techniques

Replacing Geometry with ImagesReplacing Geometry with Images

Algorithm– Select subset of model– Create image of the subset– Cull subset and replace with image

Why?– Image displayed in (approx.) constant time– Image reused for several frames

Page 28: Culling Techniques

Portal ImagesPortal Images

[Aliaga97]

Page 29: Culling Techniques

Simple ExampleSimple Example

Page 30: Culling Techniques

Simple ExampleSimple Example

Page 31: Culling Techniques

Simple ExampleSimple Example

Page 32: Culling Techniques

Creating Portal ImagesCreating Portal Images

portaleye

Ideal portal Ideal portal image would be image would be one sampled one sampled from the current from the current eye positioneye position

Page 33: Culling Techniques

Creating Portal ImagesCreating Portal Images

Reference COPs

Display one of a large number of pre-computed images (~120) portal

Page 34: Culling Techniques

Creating Portal ImagesCreating Portal Images

portal

Reference COPsor…

Warp one of a much smaller number of reference images

Page 35: Culling Techniques

Example RenderingExample Rendering

Final Scene

Geometry

Image

+ =

Page 36: Culling Techniques

Discussion on Object Space Discussion on Object Space Visibility culling with large occluders

– good for outdoor urban scenes where occluders are large and depth complexity can be very high

– not good for general scenes with small occluders

Cells and portals – gives excellent results IF you can find the cells

and portals– good for interior scenes– identifying cells and portals is often done by

hand

Page 37: Culling Techniques

VISUALIZE fx’s Occlusion Culling VISUALIZE fx’s Occlusion Culling AlgorithmAlgorithmAlgorithm (extension to OpenGL):

– Scan convert faces of object, typically bounding box of complex object, but do not write Z

– Get boolean which says if there was a Z-value from scan conversion that was closer than that of the Z-buffer (NVIDIA: get pixels seen count)

– If seen, render complex object

Page 38: Culling Techniques

VISUALIZE fx’s Occlusion Culling VISUALIZE fx’s Occlusion Culling Algorithm (cont’d)Algorithm (cont’d) Implications:

– If an object is occluded, then we gain (hopefully) a lot of performance since we only scan convert one Bounding Box (BB) instead of the entire object

– If BB is not occluded, then we have to render the object, and we lose a little performance

Drawing order matters: drawing front-to-back gives more occlusion

Page 39: Culling Techniques

Real-Time Rendering?Real-Time Rendering? In computer graphics, “real-time” is used

in a soft way: say >30 fps for most frames

In other contexts, it’s a tougher requirement: the framerate must never be <30 fps, i.e., constant framerate

What can we do?– Reactive LOD algorithm– Reactive detail culling– Reactive visual quality

Page 40: Culling Techniques

Resources and PointersResources and Pointershttp://www.realtimerendering.comJournal of Graphics Tools

– http://www.acm.org/jgt/– source for projected screen area of box– intersection test routines– occlusion culling

http://www.magic-software.com