3D Clipping.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Clipping Concepts, Algorithms for line clipping 1 of 16 Clipping - 10/16/12.
Rezanje črt in poligonov. World window & viewport window viewport screen window world window.
3D Clipping & Viewing process
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
Computer Graphics Viewing.
Clipping CSE 403 Computer Graphics Cohen Sutherland Algorithm (Line)
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
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.
Course Website: Computer Graphics 9: Clipping In 3D.
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,
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
Advanced Computer Graphics Three Dimensional Viewing
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
CSE Real Time Rendering Week 9. Post Geometry Shaders Courtesy: E. Angel and D. Shreiner – Interactive Computer Graphics 6E © Addison-Wesley 2012.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
1Computer Graphics Implementation 1 Lecture 15 John Shearer Culture Lab – space 2
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.
Three-Dimensional Viewing Clipping Computer Graphics C Version (456p - 462p)
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.
CENG 538 Advanced Graphics and UIs
Three Dimensional Viewing
Visible Surface Detection
Computer Graphics Lecture 14 CLIPPING I Taqdees A. Siddiqi
Computer Graphic 2 D Viewing.
Computer Graphics Clipping.
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
Computer Graphics Shading in OpenGL
Concepts, Algorithms for line clipping
Prof. Lizhuang Ma Shanghai Jiao Tong University
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
Computer Graphics Viewing
2D Viewing & Clipping 한신대 류승택
CSC461: Lecture 20 Parallel Projections in OpenGL
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Concepts, algorithms for clipping
Projections and Normalization
Implementation I Ed Angel
Graphics Pipeline Clipping
Computer Graphics 9: Clipping In 3D
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
WINDOWING AND CLIPPING
OpenGL 2D Viewing Pipeline
Computer Graphics : Viewing In 2D
Clipping Computer Graphics Cohen Sutherland Algorithm (Line)
WINDOWING AND CLIPPING
Lecture 13 Clipping & Scan Conversion
Joshua Barczak CMSC 435 UMBC
Two Dimensional Viewing and Clipping.
© University of Wisconsin, CS559 Fall 2004
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Prof. Lizhuang Ma Shanghai Jiao Tong University
Clipping Clipping Sutherland-Hodgman Clipping
Viewing Transformations II
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
COMPUTER GRAPHICS Clipping
Presentation transcript:

3D Clipping

3D Viewing Pipeline Primitives Object space World space Camera space Modeling Transformation World space Viewing Transformation Camera space Hidden Surface Removal Lighting & Shading 3D-Clipping Projection Normalized view space Scan conversion, Hiding Image space, Device coordinates September 15, 2018 Computer Graphics Image

Introduction Clipping Volume Clipping Strategies Clipping Algorithm Contents Introduction Clipping Volume Clipping Strategies Clipping Algorithm

3D 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 September 15, 2018 Computer Graphics

3D Clipping 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 September 15, 2018 Computer Graphics

3D Clipping Objects that are partially within the viewing volume need to be clipped – just like the 2D case September 15, 2018 Computer Graphics

Introduction Clipping Volume Clipping Strategies Clipping Algorithm Contents Introduction Clipping Volume Clipping Strategies Clipping Algorithm

The Clipping Volume In case of Parallel projections the infinite Parallelepiped is bounded by Near/front/hither and far/back/yon planes for clipping. September 15, 2018 Computer Graphics

The Clipping Volume In case of Perspective projections the semi Infinite Pyramid is also bounded by Near/front/hither and far/back/yon planes for clipping September 15, 2018 Computer Graphics

The Clipping Volume After the perspective transformation is complete the frustum shaped viewing volume has been converted to a parallelepiped - remember we preserved all z coordinate depth information September 15, 2018 Computer Graphics

Introduction Clipping Volume Clipping Strategies Clipping Algorithm Contents Introduction Clipping Volume Clipping Strategies Clipping Algorithm

Clipping Strategies Because of the extraordinary computational effort required, two types of clipping strategies are followed: Direct Clipping: The clipping is done directly against the view volume. Canonical Clipping: Normalization transformations are applied which transform the original view volume into normalized (canonical) view volume. Clipping is then performed against canonical view volume. September 15, 2018 Computer Graphics

Clipping Strategies The canonical view volume for parallel projection is the unit cube whose faces are defined by planes x = 0 ; x = 1 y = 0; y = 1 z = 0; z = 1 September 15, 2018 Computer Graphics

Introduction Clipping Volume Clipping Strategies Clipping Algorithm Contents Introduction Clipping Volume Clipping Strategies Clipping Algorithm

Clipping Algorithms 3D clipping algorithms are direct adaptation of 2D clipping algorithms with following modifications: For Cohen Sutherland: Assignment of out codes For Liang-Barsky: Introduction of new equations For Sutherland Hodgeman: Inside/Out side Test In general: Finding the intersection of Line with plane. September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping 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 1 Behind bit 2 Front bit 3 Top bit 4 Below bit 5 Right bit 6 Left September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping Now we use a 6 bit out code to handle the near and far plane. The testing strategy is virtually identical to the 2D case. September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping To clip lines we first label all end points with the appropriate region codes. Classify the category of the Line segment as follows Visible: if both end points are 000000 Invisible: if the bitwise logical AND is not 000000 Clipping Candidate: if the bitwise logical AND is 000000 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. September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping For clipping equations for three dimensional line segments are given in their parametric form. For a line segment with end points P1(x1h, y1h, z1h, h1) and P2(x2h, y2h, z2h, h2) the parametric equation describing any point on the line is: From this parametric equation of a line we can generate the equations for the homogeneous coordinates: September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping Consider the line P1[000010] to P2[001001] Because the lines have different values in bit 2 we know the line crosses the right boundary September 15, 2018 Computer Graphics

3D Cohen-Sutherland Line Clipping 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 yp and zp similarly Then simply continue as per the two dimensional line clipping algorithm September 15, 2018 Computer Graphics

Any Question !