

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Processing fragments takes time. In large scenes, many polygons project par- tially or completely outside the viewport or are outside or stick out of the viewing volume. Such primitives or their parts which stick out do not need be scan-converted. Clipping allows to compute the (parts of) primitives which are inside the viewing volume or viewport. Mathematically speaking, this is equivalent to computing intersection of a triangle with the view volume (if clipping is done before projection in 3D).
The view volume is an intersection of six half-spaces, defined by the view. The problem of computing intersection of a triangle and the view volume can be reduced to the problem of computing intersection of a convex polygon with a half-space. Basically, to clip against view volume we need to clip against each of the 6 half-spaces which define it. Note that the result of clipping a convex polygon has to be convex (intersection of convex sets is convex), so we’ll focus on convex polygons here.
Note that clipping a polygon may potentially change its number of edges. To list the vertices of a polygon clipped against a half-space we need to do the following. Walk around the boundary of the polygon, starting from some vertex until you return back to that very vertex. Whenever you encounter a vertex which is inside the half-space, output it. Do not output vertices which are outside the half- space. Also, whenever the line bounding the half-space is crossed, output the crossing point. This should be implemented in such a way that the intersection point is computed only when it exists (endpoints of the edge are on different sides of clipping plane). See Figure 1 for an example.
The procedures for clipping a polygon against a half-space can be put together in a pipeline as shown in Figure 2.
x=x
start
0
1
2
3 4
5
Figure 1: Clipping a polygon against a halfplane. Thick red lines show the clipped polygon; the black dots are the output vertices and crossings i.e. the vertices of the clipped polygon, with the numbers indicating their order.
h
clip against
vertices of the input polygon in CW order
vertices of the clipped polygon in CW order
clip against clip against clip against
clip against clip against
h2 (^) h3 h
h5 h
Figure 2: Clipping a polygon against a view volume using the procedures for clipping against half-spaces as pipeline stages.