Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS552: Computer Graphics Lecture 12: 3D Clipping.

Similar presentations


Presentation on theme: "CS552: Computer Graphics Lecture 12: 3D Clipping."— Presentation transcript:

1 CS552: Computer Graphics Lecture 12: 3D Clipping

2 Recap Parallel projection Normalized coordinate transformation o Orthographic o Oblique o Perspective

3 Objective After completing this lecture students will be able to Extend 2D clipping algorithm for 3D Solve mathematical problems on 3D clipping

4 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

5 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

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

7 Region Codes FarNearTopBottomRightLeft

8 Different test cases

9 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 o This is just like the 2 dimensional case as these lines can never cross the viewing volume o In the example that follows the line from P 3 [010101] to P 4 [100110] can be rejected

10 The Equation Of The Line For 3D Clipping

11 From this parametric equation of a line we can generate the equations for the homogeneous coordinates:

12 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

13 3D Line Clipping Example

14 3D Polygon Clipping However the most common case in 3D clipping is that we are clipping graphics objects made up of polygons

15 3D Polygon Clipping 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

16 Arbitrary Clipping Planes To clip a three-dimensional scene using additional planes that can be specified in any spatial orientation Objects behind the plane are to be clipped

17 Line clipping Case 1: Clip the entire line if both endpoints satisfy Case 2: Save the entire line if both endpoints satisfy Case 3: Point P is on the clipping plane if it satisfies the plane equation

18 Thank you Next Lecture: Raster Graphics


Download ppt "CS552: Computer Graphics Lecture 12: 3D Clipping."

Similar presentations


Ads by Google