Course Website: Computer Graphics 9: Clipping In 3D.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

3D Clipping & Viewing process
Objectives Define Clipping Various clipping methods. Line clipping methods.
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
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.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Course Website: Computer Graphics 4: Viewing In 2D.
1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:
Computer Graphics : Clipping
Computer Graphics Viewing.
Clipping CSE 403 Computer Graphics Cohen Sutherland Algorithm (Line)
Viewing & Clipping In 2D. 2 of 44 Contents Windowing Concepts Clipping –Introduction –Brute Force –Cohen-Sutherland Clipping Algorithm Area Clipping –Sutherland-Hodgman.
2D Viewing and Projection
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
1 of 25 Assignment Orthographic Wireframe Elevation Orthographic Wireframe Plan Orthographic Wireframe End-Elevation Perspective View.
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics 14: Surface Detection Methods
1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.
Course Website: Computer Graphics 3: 2D Transformations.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Clipping.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Implementation I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1 of 23 New Lecture And Lab Information Lectures: –Thursday 12:00 – 13:00 (room tba) –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00 – 11:00 (A305)
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.
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
Clipping Apart from clipping to the view volume, clipping is a basic operation in many other algorithms –Breaking space up into chunks –2D drawing and.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
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.
Advanced Computer Graphics Three Dimensional Viewing
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
Windows, Viewports, and Clipping
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
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)
EEL Introduction to Computer Graphics
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
Computer Graphics Lecture 20 Fasih ur Rehman. Last Class Clipping – What is clipping – Why we do clipping – How clipping is done.
1Computer Graphics Implementation 1 Lecture 15 John Shearer Culture Lab – space 2
Clipping Primitives. Clipping line Clipping rectangle: – x min to x max – y min to y max A point (x,y) lies within a clip rectangle and thus displayed.
Graphics Graphics & Graphical Programming Lecture 23 - Viewing & Clipping.
Perspective View Volume View Volume Far Near Window Far Near Window Center of Projection Center of Projection (a) Original Orientation (b) After Transformation.
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
Lecture 9 From Vertices to Fragments. Objectives Introduce basic implementation strategies Clipping Rasterization hidden-surface removal.
CS552: Computer Graphics Lecture 12: 3D Clipping.
Three Dimensional Viewing
Visible Surface Detection
Computer Graphics Lecture 14 CLIPPING I Taqdees A. Siddiqi
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
Computer Graphics Shading in OpenGL
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Concepts, algorithms for clipping
3D Clipping.
Implementation I Ed Angel
Graphics Pipeline Clipping
Computer Graphics 9: Clipping In 3D
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Computer Graphics : Viewing In 2D
Lecture 13 Clipping & Scan Conversion
New Lecture And Lab Information
© University of Wisconsin, CS559 Fall 2004
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Clipping Clipping Sutherland-Hodgman Clipping
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
Clipping University of British Columbia CPSC 314 Computer Graphics
Implementation I Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Course Website: Computer Graphics 9: Clipping In 3D

2 of 24 Contents In today’s lecture we are going to have a look at some perspective view demos and investigate how clipping works in 3-D –Nate Robins’ OpenGL tutorials –The clipping volume –The zone labelling scheme –3-D clipping Point clipping Line clipping Polygon clipping

3 of 24 Nate Robins’ OpenGL Tutorials Nate Robins has a number of great OpenGL tutorial applications posted on his website Nate Robin’s OpenGL Tutorials available at:

4 of 24 3-D Clipping Just like the case in two dimensions, clipping removes objects that will not be visible from the scene The point of this is to remove computational effort 3-D clipping is achieved in two basic steps –Discard objects that can’t be viewed i.e. objects that are behind the camera, outside the field of view, or too far away –Clip objects that intersect with any clipping plane

5 of 24 Discard Objects Discarding objects that cannot possibly be seen involves comparing an objects bounding box/sphere against the dimensions of the view volume –Can be done before or after projection

6 of 24 Clipping Objects Objects that are partially within the viewing volume need to be clipped – just like the 2D case

7 of 24 The Clipping Volume After the perspective transformation is complete the frustum shaped viewing volume has been converted to a parallelopiped - remember we preserved all z coordinate depth information Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

8 of 24 Normalisation The transformed volume is then normalised around position (0, 0, 0) and the z axis is reversed Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

9 of 24 When Do We Clip? We perform clipping after the projection transformation and normalisation are complete So, we have the following: We apply all clipping to these homogeneous coordinates

10 of 24 Dividing Up The World Similar to the case in two dimensions, we divide the world into regions This time we use a 6-bit region code to give us 27 different region codes The bits in these regions codes are as follows: bit 6 Far bit 5 Near bit 4 Top bit 3 Bottom bit 2 Right bit 1 Left

11 of 24 Dividing Up The World (cont..) Because we have a normalised clipping volume we can test for these regions as follows: Rearranging these we get:

12 of 24 Region Codes Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

13 of 24 Point Clipping Point clipping is trivial so we won’t spend any time on it

14 of 24 Line Clipping To clip lines we first label all end points with the appropriate region codes We can trivially accept all lines with both end-points in the [000000] region We can trivially reject all lines whose end points share a common bit in any position –This is just like the 2 dimensional case as these lines can never cross the viewing volume –In the example that follows the line from P 3 [010101] to P 4 [100110] can be rejected

15 of 24 Line Clipping Example Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

16 of 24 The Equation Of The Line For 3D Clipping For clipping equations for three dimensional line segments are given in their parametric form For a line segment with end points P 1 (x1 h, y1 h, z1 h, h1 ) and P 2 (x2 h, y2 h, z2 h, h2 ) the parametric equation describing any point on the line is:

17 of 24 The Equation Of The Line For 3D Clipping (cont…) From this parametric equation of a line we can generate the equations for the homogeneous coordinates:

18 of 24 3D Line Clipping Example Consider the line P 1 [000010] to P 2 [001001] Because the lines have different values in bit 2 we know the line crosses the right boundary Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

19 of 24 3D Line Clipping Example (cont…) Since the right boundary is at x = 1 we now know the following holds: which we can solve for u as follows: using this value for u we can then solve for y p and z p similarly

20 of 24 3D Line Clipping Example (cont…) When then simply continue as per the two dimensional line clipping algorithm

21 of 24 3D Polygon Clipping However the most common case in 3D clipping is that we are clipping graphics objects made up of polygons Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

22 of 24 3D Polygon Clipping (cont…) In this case we first try to eliminate the entire object using its bounding volume Next we perform clipping on the individual polygons using the Sutherland-Hodgman algorithm we studied previously

23 of 24 Cheating with Clipping Planes For far clipping plane introduce something to obscure far away objects – fog Make objects very near the camera transparent

24 of 24 Summary In today’s lecture we examined how clipping is achieved in 3-D