Clipping Covers chapter 10 of Computer Graphics and Virtual Environments (Slater, Steed and Chrysanthou) . See www.booksites.net/slater ©Yiorgos Chrysanthou.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Computer Graphics - Rasterization -
Visible-Surface Detection(identification)
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
1 Binary Space Partition Trees ©Anthony Steed, Yiorgos Chrysanthou
Points, Vectors, Lines, Spheres and Matrices
Polygon Scan Conversion – 11b
9.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 9 – Clipping.
GR2 Advanced Computer Graphics AGR
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
Algorithms for Geometric Covering and Piercing Problems Robert Fraser PhD defence Nov. 23, 2012.
Many slides are borrowed from Foley & Van Dam. Topics Viewing Transformation Pipeline in 2D Line and polygon clipping (Slow Fast) – Simultaneous Equations.
ABC Technology Project
© S Haughton more than 3?
Computer Graphics 4: Viewing In 2D
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Clipping Concepts, Algorithms for line clipping 1 of 16 Clipping - 10/16/12.
Squares and Square Root WALK. Solve each problem REVIEW:
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
Week 1.
We will resume in: 25 Minutes.
Dantzig-Wolfe Decomposition
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Rezanje črt in poligonov. World window & viewport window viewport screen window world window.
Line clipping: Line clipping algorithm is method of eliminate lines of outside area of the object,so outside of object viewing is Removed. Typically, any.
Advanced Light and Shadow Culling Methods Eric Lengyel.
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.
CS 551 / 645: Introductory Computer Graphics Clipping Lines and Polygons.
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:
Line Clipping Algorithms. A Cases for Clipping Lines E B H C G J I clip rectangle 2Prepared by Narendra V G CSE MIT.
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
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.
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.
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.
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
CSE Real Time Rendering Week 9. Post Geometry Shaders Courtesy: E. Angel and D. Shreiner – Interactive Computer Graphics 6E © Addison-Wesley 2012.
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)
Computer Graphics Clipping.
Transformations contd.
CS 551 / 645: Introductory Computer Graphics
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Concepts, algorithms for clipping
Graphics Pipeline Clipping
WINDOWING AND CLIPPING
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
WINDOWING AND CLIPPING
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
© University of Wisconsin, CS559 Fall 2004
(c) 2002 University of Wisconsin, CS559
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Clipping Polygons Dr. Scott Schaefer.
Clipping Clipping Sutherland-Hodgman Clipping
Clipping University of British Columbia CPSC 314 Computer Graphics
COMPUTER GRAPHICS Clipping
Presentation transcript:

Clipping Covers chapter 10 of Computer Graphics and Virtual Environments (Slater, Steed and Chrysanthou) . See www.booksites.net/slater ©Yiorgos Chrysanthou 2001, Anthony Steed 2002-2003, Celine Loscos 2004

Clipping Summary It’s the process of finding the exact part of a polygon lying inside the view volume To maintain consistency, clipping of a polygon should result in a polygon, not a sequence of partially unconnected lines We will first look at 2 different 2D solutions and then extend one to 3D

Sutherland-Hodgman Algorithm p 1 3 2 4 Clip to top Clip the polygon against each boundary of the clip region successively Result is possibly NULL if polygon is outside Can be generalised to work for any polygonal clip region, not just rectangular Clip to right etc

Clipping To A Region To find the new polygon right clip boundary iterate through each of the polygon edges and construct a new sequence of points starting with an empty sequence for each edge there are 4 possible cases to consider P0 P1 P2 P3 clip region

Clipping a polygon edge against the boundary Visible Side Given an edge P0,P1 we have 4 cases: entering the clipping region add P and P1 leaving the region add only P entirely outside do nothing entirely inside add only P1 Where P is the point of intersection p 1 p 1 p 1 p 1 OUT IN

Still the Sutherland-Hodgman We can determine which of the 4 cases and also the point of intersection with just if statements To sum it up, an example: P0 P1 P2 P3 Pa Pb P0 P3

Weiler-Atherton Algorithm When we have non-convex polygons then the algorithm above might produce polygons with coincident edges This is fine for rendering but maybe not for other applications (eg shadows) The Weiler-Atherton algorithm produces separate polygons for each visible fragment

Weiler-Atherton Algorithm b c d 1 2 3 4 5 6 7 8 9 A B i j k l clip region polygon 1 2 3 5 4 6 8 7 9 a b c d loop of region vertices loop of polygon vertices

Find the intersection vertices and connect them in the two lists polygon Add vertex i: 1 1 2 i a B 8 2 7 a i j b 3 l b 4 9 k 6 5 A 5 k c 4 l 3 6 d c 7 j d 8 clip region 9

Find the intersection vertices and connect them in the two lists polygon Add vertex l: 1 1 2 i a B 8 2 7 a i j b 3 l b 4 9 k 6 5 A 5 k c 4 l 3 6 d c 7 j d 8 clip region 9

Find the intersection vertices and connect them in the two lists polygon Add vertex k: 1 1 2 i a B 8 2 7 a i j b 3 l b 4 9 k 6 5 A 5 k c 4 l 3 6 d c 7 j d 8 clip region 9

Completed Loop polygon Add vertex j: clip region 1 i 2 3 l 4 5 k 6 7 j 1 1 2 i a B 8 2 7 a i j b 3 l b 4 9 k 6 5 A 5 k c 4 l 3 6 d c 7 j d 8 clip region 9

Classify each intersection vertex as Entering or Leaving polygon Entering Leaving 1 1 2 i a B 8 2 7 a i j b 3 l b 4 9 k 6 5 A 5 k c 4 l 3 6 d c 7 j d 8 clip region 9

Capture clipped polygons Entering Start at an entering vertex If you encounter a leaving vertex swap to right hand (clip polygon) loop If you encounter an entering vertex swap to left hand (polygon) loop A loop is finished when you arrive back at start Repeat whilst there are entering vertices Leaving 1 i a 2 3 l b 4 5 k c 6 7 j d 8 9

Capture clipped polygons Entering Loop 1: L, 4, 5, K Loop 2: J, 9, 0, i Leaving 1 i a 2 3 l b 4 5 k c 6 7 j d 8 9

Clipping Polygons in 3D The Sutherland-Hodgman can easily be extended to 3D the clipping boundaries are 6 planes instead of 4 lines intersection calculation is done by comparing an edge to a plane instead of edge to edge It can either be done in Projection Space or in Canonical Perspective

Clipping in Projection Space The view volume is defined by: Testing for the 4 cases is fast, for example for the x = 1 (right) clip plane: x0  1 and x1  1 entirely inside x0  1 and x1 > 1 leaving x0 > 1 and x1  1 entering x0 > 1 and x1 > 1 entirely outside

Clipping in Canonical Perspective When we have an edge that extends from the front to behind the COP, then if we clip after projection (which in effect is what the PS does) we might get wrong results top View plane V + 1 p 2 p 1 q 1 N O C O P q 2 - 1 bottom

Clipping in Homogeneous Coord. The Sutherland-Hodgman can also be used for clipping in 4D before dividing the points by the w This can have the advantage that is even more general, it even allows for the front clip plane to be behind the COP

Clipping Recap Sutherland-Hodgman is simple to describe but fails in certain cases Weiler-Atherton clipping is more robust but considerably harder Both extend to 3D but we need to consider projection and end up clipping in 4D