Docsity

Clipping Polygons Against View Volume in 3D Computer Graphics, Study Guides, Projects, Research of Computer Graphics

Toggle sidebar
bg1
Clipping
1 Purpose
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).
2 Pipeline approach
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.
2.1 Clipping a polygon against half-space
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.
2.2 The clipping pipeline
The procedures for clipping a polygon against a half-space can be put together
in a pipeline as shown in Figure 2.
2.3 Clipping against a view volume
1
pf2

Partial preview of the text

Download Clipping Polygons Against View Volume in 3D Computer Graphics and more Study Guides, Projects, Research Computer Graphics in PDF only on Docsity!

Clipping

1 Purpose

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).

2 Pipeline approach

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.

2.1 Clipping a polygon against half-space

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.

2.2 The clipping pipeline

The procedures for clipping a polygon against a half-space can be put together in a pipeline as shown in Figure 2.

2.3 Clipping against a view volume

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.