1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.

Slides:



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

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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
CS 551 / 645: Introductory Computer Graphics Visible Surface Determination.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
Computer Graphics Viewing.
CS 445 / 645: Introductory Computer Graphics
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Interpolation Clipping.
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
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.
Course Website: Computer Graphics 9: Clipping In 3D.
1 Jinxiang Chai CSCE 441 Computer Graphics. 2 Midterm Time: 10:10pm-11:20pm, 10/20 Location: HRBB 113.
1 Clipping and Hidden Surfaces CS-184: Computer Graphics Prof. James O’Brien.
Spatial Data Structure: Quadtree, Octree,and BSP tree Mengxia Zhu Fall 2007.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility Week 7, Wed.
Graphics Pipeline Clipping CMSC 435/634. Graphics Pipeline Object-order approach to rendering Sequence of operations – Vertex processing – Transforms.
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
Hidden Surface Removal
Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
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.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
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”
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
The BSP-tree from Prof. Seth MIT.. Motivation for BSP Trees: The Visibility Problem We have a set of objects (either 2d or 3d) in space. We have.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
CAP4730: Computational Structures in Computer Graphics
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Implementation II.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
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.
Chapter III Rasterization
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Computer Graphics I, Fall 2010 Implementation II.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
CENG 538 Advanced Graphics and UIs
Rendering Pipeline Fall, 2015.
Computer Graphics Implementation II
Inside-Outside & Culling
Week 2 - Friday CS361.
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
Lecture 13 Clipping & Scan Conversion
Clipping University of British Columbia CPSC 314 Computer Graphics
Presentation transcript:

1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009

2 Today’s topics ■Lines and planes ■Culling °View frustum culling °Back-face culling °Occlusion culling °Hierarchical culling ■Clipping

3 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

4 Culling example ■Power plant model °13 M triangles °1.7 M triangles - gutted version show here with no internal pipes

2/05/07 5 Culling example Full model 1.7 Mtris View frustum culling 1.4 Mtris Occulsion culling 89 Ktris

6 ■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 planes d (0,0) l  p  0 

2/05/07 7 ■Lines (planes) partition 2D (3D) space: °positive and negative half spaces ■The union of negative half-spaces defines a convex region Lines and planes d (0,0) l  p  0 

8 Testing objects for containment                OutsideStraddlingInside

2/05/07 9 Conservative testing Outside r Indeterminate r Inside r ■Use cheap, conservative bounds for trivial cases ■Can use more accurate, more expensive tests for ambiguous cases if needed

2/05/07 10 View frustum culling ■Test objects against planes defining view frustum ■How do you compute them? ■Other planes can be computed similarly 1 1 column 1- column 3

2/05/07 11 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 visited Inside Indeterminate Outside Inside

2/05/07 12 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

13 Manifold ■Back-face culling can be applied to any orientable two- manifold. ■Orientable two-manifolds have the following properties. 1.All points on the surface are locally like a plane. No holes, cracks, or self-intersections. 2.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.

2/05/07 14 Face plane test ■Compute the plane for the face: ■Cull if eye point in the negative half-space

15 Winding order test ■Back-faces have a clockwise vertex ordering when viewed from outside. ■Typically used by graphics hardware during triangle setup

2/05/07 16 Back-face culling in OpenGL if (cull): glFrontFace(GL_CCW) # define winding order glEnable(GL_CULL_FACE) # enable Culling glCullFace(GL_BACK) # which faces to cull else: glDisable(GL_CULL_FACE) ■Can cull front faces or back faces ■Back-face can sometimes double performance front-face culling

2/05/07 17 Occlusion culling with occlusion queries ■Render objects visible in previous frame (occlusion representation)

2/05/07 18 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

2/05/07 19 Occlusion culling with occlusion queries ■Re-enable color writes ■Render newly visible objects

20 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

21 Clipping a polygon against a line ■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

22 Clipping against a convex region ■Sutherland-Hodgman °Just clip against one edge at a time

2/05/07 23 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 1 x w Add extra coordinate so we can use our line equation

2/05/07 24 Culling and clipping in the rendering pipeline Culling done by application View frustum clipping on clip coordinates. Back-face culling done in setup phase of rasterization. Eye coordinates. View frustum clipping and back-face culling can be done here