HiddenSurface Removal: Culling and Clipping - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

HiddenSurface Removal: Culling and Clipping

Description:

parallel projection: view volume is parallelepiped ... e.g. parallelepiped, frustum. View-volume / back-face culling, and bounding volumes ... – PowerPoint PPT presentation

Number of Views:140
Avg rating:3.0/5.0
Slides: 20
Provided by: claudecch
Category:

less

Transcript and Presenter's Notes

Title: HiddenSurface Removal: Culling and Clipping


1
School of Computing Staffordshire University
3D Computer Graphics
Hidden-Surface RemovalCulling and Clipping
Dr. Claude C. Chibelushi
2
Outline
  • Introduction
  • Efficiency considerations
  • Back-face culling
  • View-volume culling
  • Bounding volumes View volume
  • Culling
  • Polygon clipping
  • Summary

3
Introduction
  • Complexity of graphics worlds is increasing
  • need to avoid potential increase in computational
    cost
  • accelerate rendering of large environments by
    minimising geometric complexity
  • approaches visibility culling, level-of-detail
    representation, image-based rendering
  • typically, only small fraction of graphics world
    is visible
  • many techniques based on estimation of
    potentially visible portion of world

4
Introduction
  • Culling / clipping
  • identification and removal of segments which are
  • occluded by other surfaces of same opaque object
  • e.g. cull back-facing polygons
  • outside field of view
  • cull segments that do not project onto view
    window
  • clip primitives that are partially inside field
    of view
  • 3D volume against which objects are culled /
    clipped is called view volume (or clipping volume)

5
Efficiency Considerations
  • Reduction of computational cost
  • cull invisible segments from graphics pipeline
  • as early as possible
  • using low cost visibility tests
  • to avoid lengthy occlusion tests for trivial
    cases, e.g.
  • apply extent testing (e.g. frustum culling)
  • apply occlusion culling (e.g. back-face culling)

6
Efficiency Considerations
  • Extent testing tests based on bounding boxes /
    volumes
  • object / frustum culling
  • if bounding volume of object is outside field of
    view
  • Back-face culling for opaque solid objects
  • computational savings
  • in general, approximately half of object faces
    are back-facing
  • hence, back-face culling approximately halves
    rendering time

7
Efficiency Considerations
3D Models
Possible 3D graphics pipeline for scene
comprising single convex object
8
Back-Face Culling
visible
invisible
visible
9
Back-Face Culling
  • Implementation
  • Dot product of plane normal with sight vector
    (from any point on polygon to centre of
    projection)
  • positive front-facing polygon
  • negative back-facing polygon
  • zero line of sight flush with polygon surface
  • Limitation view direction not taken into account
  • viewer could be looking away from object
  • requires view-volume culling / clipping

10
Back-Face Culling
  • Implementation ctd.

Note anticlockwise order of vertices
Front-facing surface n ? s1e ? 0 Back-facing
surface n ? s1e ? 0
11
View-Volume Culling
  • Objects often enclosed in bounding volume
  • to reduce computational costs of e.g.
  • frustum culling, collision detection, ray tracing
  • Many types of bounding volumes
  • bounding box
  • parameters object extent
  • bounding sphere
  • parameters object centre and radius

12
View-Volume Culling
  • Bounding volumes (2D representation)
  • Bounding efficiency may be low
  • potential for false positives

13
View-Volume Culling
  • View volume
  • Determines what part of scene projects onto view
    window
  • only part of scene within view volume will be
    displayed
  • Shape of view volume determined by projection
    method
  • parallel projection view volume is
    parallelepiped
  • perspective projection view volume is frustum

14
View-Volume Culling
15
View-Volume Culling
16
View-Volume Culling
Scene segment
Core logic for view-volume culling (e.g. segment
is object enclosed in bounding volume)
17
View-Volume Culling
  • Frustum culling algorithm for bounding box
  • cullBoundingBox()
  • if any box corner inside frustum
  • return IN
  • else if all box corners outside same frustum
    plane
  • return OUT
  • else if any frustum edge intersects box face
  • return IN
  • else if any box edge intersects frustum face
  • return IN
  • else if any frustum corner outside any box plane
  • return OUT
  • else return IN

18
View-Volume Culling
  • Parallel orthographic projection
  • Tests for detecting scene point inside view
    volume
  • (B and F subscripts refer to back and front
    clipping planes respectively)

19
View-Volume Culling
  • Perspective projection
  • Tests for detecting scene point inside view
    volume
  • based on similar-triangles formula

20
View-Volume Culling
  • Alternative tests for detecting scene point
    inside view volume
  • insert point coordinates into plane equation for
    each frustum face result is
  • positive for point on higher-coordinate side of
    plane
  • negative for point on lower-coordinate side of
    plane
  • zero for point inside plane
  • e.g. above / below right / left in front /
    behind plane
  • test whether combination of signs for all planes
    indicates point is inside view volume

21
View-Volume Culling
  • Intersection between edge and face
  • Computation
  • calculate equation of face plane
  • calculate intersection between edge and plane
  • determine whether intersection contained in face
  • project intersection point and face onto nearest
    2D coordinate plane (i.e. x-y, y-z, or x-z)
  • determine whether point is to left (or right) of
    all face edges
  • if yes, intersection exists

22
View-Volume Culling
Intersection between edge and plane
  • Intersection

23
Polygon Clipping
  • Clipping against view volume
  • 3D clipping requires intersection calculation
  • between polygon edges and view volume faces
  • polygon clipping may introduce more vertices

24
Polygon Clipping
  • Scissoring
  • Clipping during scan conversion (i.e. 2D)
  • only pixels within viewport will be displayed
  • check pixel coordinates against bounds of
    viewport
  • simple and general approach
  • Simple primitives (e.g. lines, polygons)
  • scissoring may be wasteful if large portion of
    primitives lies outside view volume
  • Complex primitives (e.g. parametric patches)
  • scissoring may be the only practical solution

25
Suggested Reading
  • Relevant parts of Ch. 12, D. Hearn, M.P. Baker,
    Computer Graphics, 2nd Ed. in C, Prentice-Hall,
    1996.
  • Relevant parts of Ch. 10, 14, 15, A. LaMothe,
    Black Art of 3D Game Programming, Waite Group
    Press, 1995.
  • Relevant parts of Ch. 9, A. Watt, F. Policarpo,
    3D Games Real-Time Rendering and Software
    Technology, Addison-Wesley, 2001.

26
Summary
  • Culling / clipping
  • identification and removal of segments that are
    outside field of view
  • e.g. parallelepiped, frustum
  • View-volume / back-face culling, and bounding
    volumes
  • improve computational efficiency

27
Summary
  • View-volume culling
  • based on containment and intersection tests
  • Back-face culling
  • based on orientation test
  • Polygon clipping in 3D, or 2D (scissoring)
Write a Comment
User Comments (0)
About PowerShow.com