Visiblity culling and clipping
1 / 24

Visiblity: Culling and Clipping - PowerPoint PPT Presentation

  • Uploaded on

Visiblity: Culling and Clipping. Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009. Today’s topics. Lines and planes Culling View frustum culling Back-face culling Occlusion culling Hierarchical culling Clipping. What are culling and clipping?. Culling

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Visiblity: Culling and Clipping' - lynley

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Visiblity culling and clipping l.jpg

Visiblity: Culling and Clipping

Computer GraphicsCOMP 770 (236)Spring 2009

January 21 & 26: 2009

Today s topics l.jpg
Today’s topics

  • Lines and planes

  • Culling

    • View frustum culling

    • Back-face culling

    • Occlusion culling

    • Hierarchical culling

  • Clipping

What are culling and clipping l.jpg
What are culling and clipping?

  • Culling

    • Throws away entire objects and primitives that cannot possibly be visible

    • An important rendering optimization (esp. for large models)

  • Clipping

    • “Clips off” the visible portion of a primitive

    • Simplifies rasterization

    • Used to create “cut-away” views of a model

Culling example l.jpg

Power plant model

13 M triangles

1.7 M triangles - gutted version show here with no internal pipes

Culling example

Culling example5 l.jpg
Culling example

Full model1.7 Mtris

View frustum culling1.4 Mtris

Occulsion culling89 Ktris

Lines and planes l.jpg

l  p = 0

Lines and planes

  • Implicit equation for line (plane):

  • If is normalized then d gives the distance of the line (plane) from the origin along

  • Transforming points and lines with transformation M: points: lines:



Lines and planes7 l.jpg

l  p = 0

Lines and planes

  • Lines (planes) partition 2D (3D)space:

    • positive and negative half spaces

  • The union of negative half-spacesdefines a convex region



Testing objects for containment l.jpg
Testing objects for containment



















Conservative testing l.jpg





Conservative testing

  • Use cheap, conservative bounds for trivial cases

  • Can use more accurate, more expensive tests for ambiguous cases if needed



View frustum culling l.jpg





View frustum culling

  • Test objects against planes defining view frustum

  • How do you compute them?

  • Other planes can be computed similarly

column 1- column 3

Hierachical culling l.jpg
Hierachical culling

  • Culling needs to be cheap!

  • Bounding volume hierarchies accelerate culling by trivially rejecting/accepting entire sub-trees at a time

  • Simple algorithm: while( node is indeterminate ) recurse on children

not visited









Back face culling l.jpg
Back-face culling

  • Special case of occlusion - convex self-occlusion

    • for closed objects (has well-defined inside and outside) some parts of the surface must be blocked by other parts of the surface

  • Specifically, the backside of the object is not visible

Manifold l.jpg

  • Back-face culling can be applied to any orientable two-manifold.

  • Orientable two-manifolds have the following properties.

    • All points on the surface are locally like a plane. No holes, cracks, or self-intersections.

    • Boundary partitions 3D space into interior and exterior regions

  • In our case, manifolds will be composite objects made of many primitives, generally triangles.

  • Back-face culling eliminates a subset of these primitives.

    • Assumes that you are outside of all objects.

Face plane test l.jpg
Face plane test

  • Compute the plane for the face:

  • Cull if eye point in the negative half-space

Winding order test l.jpg
Winding order test

  • Back-faces have a clockwise vertex ordering when viewed from outside.

  • Typically used by graphics hardware during triangle setup

Back face culling in opengl l.jpg
Back-face culling in OpenGL

  • Can cull front faces or back faces

  • Back-face can sometimes double performance

if (cull):

glFrontFace(GL_CCW) # define winding order

glEnable(GL_CULL_FACE) # enable Culling

glCullFace(GL_BACK) # which faces to cull



front-face culling

Occlusion culling with occlusion queries l.jpg
Occlusion culling with occlusion queries

  • Render objects visible in previous frame (occlusion representation)

Occlusion culling with occlusion queries18 l.jpg
Occlusion culling with occlusion queries

  • Turn off color and depth writes.

  • Render object bounding boxes with occlusion queries.

    • An occlusion query returns the number of visible pixels

newly visible

Occlusion culling with occlusion queries19 l.jpg
Occlusion culling with occlusion queries

  • Re-enable color writes

  • Render newly visible objects

Clipping a line segment against a line l.jpg
Clipping a line segment against a line

  • First check endpoints against the plane. If they are on the same side, no clipping is needed

  • Interpolate to get new point

  • Vertex attributes interpolated the same way

Clipping a polygon against a line l.jpg

Traverse edges

Keep edges that are entirely inside

Create new point when we exit

Throw away edges entirely outside

Create new point and new edge when we enter

Clipping a polygon against a line

Clipping against a convex region l.jpg
Clipping against a convex region

  • Sutherland-Hodgman

    • Just clip against one edge ata time

Homogeneous clipping l.jpg
Homogeneous clipping

  • NDC simplify view frustum clipping

  • Clip after applying projection matrix, but before the divide by w

    • clip coordinates

  • Easy in/out test and interpolation. Other coordinates treated exactly the same way

Add extra coordinateso we can use our line






Culling and clipping in the rendering pipeline l.jpg
Culling and clipping in therendering pipeline

Culling done by application

Eye coordinates. View frustum clipping andback-face culling can be done here

View frustum clipping on clip coordinates.Back-face culling done in setup phaseof rasterization.