Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

COMPUTER

AIDED
GEOMETRIC
DESIGN
ELSEVIER Computer Aided Geometric Design 13 (1996) 163-177

Tessellation of trimmed NURB surfaces


William L. Luken
T.J. Watson Research Center, J2-B37, P.O. Box 704, Yorktown Heights, NY 10598, USA

Received March 1995

Abstract
The process of rendering a trimmed NURB surface may be divided into four basic steps:
(a) tessellating the trimming contours, (b) tessellating the supporting surface, (c) mapping the
trimming contours onto the supporting surface, and (d) rendering the resulting tessellants. Instead
of dividing the supporting surface into patches, the surface is divided into strips corresponding to
intervals in one of the parametric coordinates (v). Each of these strips extends across the entire
range of the u parameter. The trimming contours are clipped to these strips before evaluating the
surface within each strip. Each strip is then divided into uv rectangles determined by intervals
in the second parametric coordinate (u). The v-clipped trimming contours are clipped to each u
interval to determine a set of planar or nearly planar polygons representing the trimmed surface.
Coordinates and normals for the comers of the uv rectangles are detemfined by the parametric
equations of the supporting surface. Coordinates and normals of points lying on trimming curves
are determined by interpolation between vertices of the uv rectangles.

Keywonts: Trimmed NURBS; Tessellation; Rendering; Parametric surfaces

1. Introduction

Trimmed NURB surfaces are widely used to support the representation of curved sur-
faces in computer aided design ( C A D ) . As such, trimmed NURB surfaces are provided
as modeling primitives in a number of geometric modeling software systems, and the
rendering of trimmed NURB surfaces as graphics primitives is supported by interna-
tional standards such as P H I G S + (van Dam, 1988) as well as graphics programming
interfaces such as Iris-GL and OpenGL (Silicon Graphics, Inc.), Starbase (Hewlett-
Packard Corp.), and RenderMan (Pixar). These 3d graphics programming interfaces
are generally in agreement as to the basic definition of a NURB surface, including
trimmed NURB surfaces, but there is considerable variation among the means provided
for controlling the tessellation o f these surfaces.

0167-8396/96/$15.00 (~ 1996 Elsevier Science B.V. All rights reserved


SSD10167-8396(95)00019-4
164 W.L. Luken/ComputerAided Geometric Design 13 (1996) 163-177

v span I

I:i:?i:i:i:~l ~l/i:i:i:i:i:i:i:i:i:i:i:i:i:! il
v span I

v span I

v span I
< >< ~< ~ < >< >
u span u span u span u span u span
Fig. 1. Division of the uv parameterspace into patches.

This work is concerned with the task of rendering trimmed NURB surfaces. That is,
determining the coordinates and colors for a set of pixels in a frame buffer representing
a numerical specification of a trimmed NURB surface. For the purposes of this work,
a trimmed NURB surface is defined by two principal components: (a) a supporting
surface, and (b) a set of trimming contours defined in the parameter space of the
supporting surface. The supporting surface is defined by an untrimmed NURB surface,

x(u, v) = wx(u, v ) / w ( u , v),


y(u,v) = wy(u,v)/w(u,v), and
z (u, v) --- wz (u, v ) / w ( u , v),
where the parametric functions w x ( u , v ) , w y ( u , v ) , w z ( u , v ) , and w ( u , v ) are deter-
mined by a matrix of 3d control points (Cx, Cy, Cz ), associated weights (Cw), a u knot
vector, and a v knot vector (Foley et al,, 1990; Rockwood et al., 1989; van Dam, 1988).
The u and v parametric coordinates each cover a particular range of values determined
by the knot vectors. Each of these ranges is in turn divided into one or more spans
determined by successive values within each knot vector. The region of a supporting
surface determined by the direct product of a u span and a v span is called a patch. The
relationship between u spans, v spans, and uv patches is illustrated in Fig. 1.
A trimmed NURB surface may possess one or more trimming contours, each defined
by a closed loop composed of a sequence of one or more NURB curves. Each curve
may be expressed in the form

u(t) = w u ( t ) / w ( t ) and v(t) = w v ( t ) / w ( t ) ,

where wu(t), wv(t), and w(t) are determined by a set of control points (ui, vi), weights
(wi), and t knot vectors, and may consist of multiple spans within the range of the
parametric coordinate (t).
The set of contours divides the supporting surface into an interior or retained region
and an exterior or discarded region based on the odd-winding rule. The curve-handedness
rule (van Dam, 1988) may also be used to impose a canonical direction on the para-
W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177 165

trimming contour 1

J
contour 3

trimming contour 2
Fig. 2. Placement of trimming contours within the uv parameter space of a parametric surface.

metric coordinate (t) for each trimming curve, but this is not required in the techniques
presented in this work. The curve-handedness rule cannot be applied if the contours
cross one another or themselves (as in a "figure 8").
Fig. 2 presents an example of the parameter space for a surface with three trimming
contours. In this example, the shaded area represents the interior region of the surface.

2. Rendering a trimmed NURB surface

In principle, a trimmed NURB surface may be rendered using algorithms which con-
vert the control points, weights, and knot vectors describing the surface directly into
the coordinates and colors of the pixels required to represent the surface (Catmull,
1974; Lane and Reisenfeld, 1980). Although algorithms have been proposed and imple-
mented based on this approach, the complexity and cost of these calculations increase
rapidly with the order of the surface. It is difficult to accommodate the illumination
calculations required to determine the colors of the pixels in this approach. In addi-
tion, this approach cannot benefit from fast polygon rendering algorithms commonly
implemented in hardware (Rockwood et al., 1989). Consequently, this approach is not
practical except possibly for very simple cases.
As an alternative, a trimmed NURB surface may be rendered in two stages. In the first
stage, the surface is divided into a number of planar or nearly planar tessellants (triangles
or other polygons). In the second stage, these tessellants are rendered using conventional
algorithms for planar polygons. In this case, the potentially complex calculations required
to evaluate the coordinates and colors of a surface are performed only at the vertices
of the tessellants, whose number is typically small compared to the number of pixels
required to represent the surface. The complexity of these calculations is relatively
modest and depends on the order of the surface, although the cost of these calculations
increases with increasing surface order. In addition, this approach may take advantage of
166 W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177

hardware polygon rendering facilities to achieve real-time rendering of trimmed NURB


surfaces (Lien et al., 1987; Luken, 1992; Rockwood et al., 1989; Shantz and Chang,
1988).
This indirect approach depends on approximating the surface with planar tessellants.
Consequently, this approach requires consideration of possible criteria for controlling the
fidelity of the approximation. These criteria are not part of the definition of the surface
(i.e., control points, weights, and knot vectors) and must be managed as additional
conditions specified independently of the trimmed NURB surface (van Dam, 1988).
The time required to render a trimmed NURB surface usually depends strongly on
these criteria and, in some circumstances, a graphics application may choose to specify
conditions resulting in visible defects and distortions to the surfaces being rendered. As
a result, a robust rendering algorithm must be capable of producing suitable images even
for poor choices of the approximation criteria.
The three criteria most commonly used to control the tessellation of parametric curves
and surfaces are (a) the number of intervals per span in each parametric coordinate, (b)
chordal length, and (c) chordal deviation. The first criterion has the obvious advantage
of simplicity, as it does not depend on the data used to specify the surface. However,
this method has the disadvantage of generating too many tessellants for patches which
are small or relatively flat, resulting in poor performance, while generating too few
tessellants in large areas and areas of high curvature, resulting in poor quality.
The chordal length criterion may be expressed as the requirement that each span of
a curve must be divided into a number of intervals whose end points are separated by
distances less than or equal to a specified distance or number of pixels. In this case, the
number of intervals for a particular span may be given by

nl = 1 + Int( spanlength/maxlength ) ,

where spanlength is an estimate or bound on the total length of the arc for this span,
and maxlength is the limit on the largest individual segment to be used to approximate
this arc. The value of spanlength need not be determined with a high precision.
A similar condition may be expressed for the lengths of the edges of the tessellants
(polygons) used to represent a surface. This criterion tends to be most useful for
very small patches and regions with very low curvature, but fails to provide adequate
tessellation for curves or surfaces with high curvature. This criterion cannot ensure
accurate representation of the geometry of a curve or surface unless the maximum
length is set to a single pixel, leading to over tessellation and poor performance for
large areas of low curvature.
The chordal deviation criterion may be expressed as the requirement that each span
of a curve or each patch of a surface must be divided into a number of tessellants such
that the distance between the true curve or surface and the resulting tessellants should
not exceed a specified tolerance. This may be accomplished with a calculation such as

n2 = 1 + V/ spanchord /maxerror,

where spanchord is an estimate or bound on the chordal deviation for a complete


span, and maxerror is the maximum deviation permitted between an individual segment
W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177 167

and the exact curve. As with spanlength, the value of spanchord does not need to be
estimated with great precision. Specification of a tolerance on the order of 0.5 pixels is
usually sufficient to obtain a satisfactory representation of the geometry of a curve or
surface with the minimal number of tessellants.
Although the chordal deviation criterion can reliably yield an accurate geometry, it
may be unsatisfactory with respect to non-geometrical aspects of a surface, such as the
accuracy of the lighting calculations performed to determine the colors at the vertices
of the polygons used to represent a surface, especially for large fiat areas where very
few polygons are required to represent the geometry accurately. Decreasing the chordal
deviation threshold does not improve this situation. Instead, it may be necessary to
employ a composite criterion based on several simultaneous conditions. For example,
one could specify that each span of a curve be divided into n intervals where

n = max[no,nl,n2],

and r~ is a constant (e.g., 1), nl is the number of intervals required to satisfy the
chordal length criterion based on a length of, e.g., 10 pixels, and n2 is the number of
intervals required to satisfy the chordal deviation criterion with a tolerance of, e.g., 0.5
pixels. Such a composite criterion would make it possible to control both the geometric
fidelity as well as the accuracy of lighting calculations. Current 3d graphics programming
interfaces such as OpenGL and PHIGS+ (van Dam, 1988), however, do not permit such
composite criteria.

3. Tessellation of a t r i m m e d NURB surface

Having adopted appropriate criteria for approximating a trimmed NURB surface, the
process of rendering the surface may be divided into four tasks:
(a) tessellation of the trimming contours,
(b) tessellation of the supporting surface,
(c) mapping trimming contours onto the supporting surface,
(d) rendering planar polygons.
The first of these tasks consists of evaluating the trimming curve tessellation criteria for
every trimming curve, determining the number of intervals needed for each span of every
trimming curve, and evaluating the parametric functions for each curve at the ends of
each of these intervals. The effect is to convert the trimming contours into a polygon or
fill area set in the uv parameter space of the supporting surface. The resulting trimming
polygon may have many vertices and multiple contours. In addition, the interior of the
resulting polygon may be concave.
The principal difficulty with this task arises from the fact that the trimming curves are
defined in the uo parameter space of the supporting surface. In order to perform adaptive
tessellation of the trimming curves, the characteristics (i.e., chord length and chordal
deviation values) must be estimated in 3d world coordinates or projected 3d coordinates.
Means for estimating the ratio of world coordinate distances to uv parametric coordinates
are presented elsewhere (Cheng and Luken, 1992; Lien et al., 1987; Luken, 1992).
168 W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177

The second task consists of evaluating the tessellation criteria for the supporting sur-
face, dividing the parameter space of the supporting surface into a number of tessellants
based on these criteria, and evaluating the parametric equations for the supporting sur-
face at the vertices of these tessellants. The result is a set of positions and normal
vectors representing the vertices of the supporting surface in world coordinates. These
first two tasks are largely independent. That is, although the first task depends on the
definition of the supporting surface, it does not depend on how the supporting surface
is tessellated. Likewise, the tessellation of the supporting surface is independent of the
existence or disposition of the trimming contours, although one may avoid evaluation
of the surface coordinates and normal vectors for tessellants lying entirely outside the
trimming contours. Two methods for performing this task are compared in the next
section.
The third task effectively merges the results of the first two tasks to identify the
portions of the supporting surface which are to be retained and which portions are to
be rejected. The results are a sequence of planar or nearly planar polygons which are
rendered in the fourth task. Means for accomplishing the third task are presented below.
Means for rendering planar polygons, including concave polygons and complex fill area
sets are well known and will not be elaborated here.

4. Tessellation of the supporting surface

The first step in conventional algorithms for rendering parametric surfaces is to divide
the surface into patches (Rockwood et al., 1989; Shantz and Chang, 1988). This requires
decomposing the set of trimming contours for the surface into a set of closed contours
for each patch, as illustrated in Fig. 3. Each of the patches is then rendered independently

[iiiiiil Niiiiiii(1J
I I1( I)iil Nil
Ni Iiii!iiiil Niiii==
Fig. 3. Decompositionof the uv parameterspaceand trimmingcontoursinto independentpatchesand trimming
contours for each patch. Trimmingcontoursfor some patches may be simplifiedby eliminationof redundant
boundary contours.
W.L. Luken/ComputerAided GeometricDesign 13 (1996) 163-177 169

u interval
< )

I U R iiiiiiiiiiiiiiiiiiiiiii!i iiiiiii!iii!iii!!iiiiiiiiiiiiil
i*iiiiiiiiiiiiiiiiiiiiiiii~iii~i~
iiiiiiiiiiii~ii#iiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii~i
H
~i~iiii~,ii:i~iiiiiiiiiiiiii~iiiii~i*~
Iiiiiiiiiiiiiiiiiiiiiiiiiiiiiil
ii iiliIi iiil I v interval

v span
lii!iiiiiiiiiiii iiiiiii "-
iiiiiiiiiiiiiiiiiiiiiiiiiiiii I

I
g
u span
Fig. 4. Division of a single patch into u intervals and v intervals based on the surface tessellation criteria.

of the other patches. For each patch, the surface tessellation criteria are evaluated to
determine how finely the patch must be tessellated. Based on the surface tessellation
criteria, each patch may be divided into a grid determined by intervals in the u parameter
and the v parameter, as shown in Fig. 4.
As a result of evaluating the tessellation criteria for each patch, the complete surface
is divided into a grid of grids, as illustrated in Fig. 5. The dimensions o f the grids
determined for each of the patches may be summarized with two matrices Nu and N v ,
where Nu (i, j ) and Nv (i, j ) indicate that the patch corresponding the ith span o f the u
parameter and the jth span of the v parameter is to be divided into a grid corresponding
to N u ( i , j ) (or more) intervals in the u parameters and N v ( i , j ) (or more) intervals in
the v parameter.
The problem with this approach is that unwanted gaps may appear at the boundaries
between adjacent patches unless additional measures are taken to eliminate such gaps.
One solution to this problem is the label-driven subdivision method in which each patch

!
Fig. 5. A grid of grids determined by independent tessellation of each patch.
170 W.L. Luken / Computer Aided Geometric Design 13 (1996) 163-177

is subdivided into a modified grid such that neighboring patched are divided into equal
intervals at their common boundaries (Cheng et al., 1989; Cbeng et al., 1988; Cheng
and Mehra, 1990). Another approach is the "coving" technique in which the boundaries
of each patch are represented by sequences of triangles which allow adjacent patches
to match at their common boundaries (Rockwood et al., 1989). Both of these methods
are based on the assumption that the cost per vertex (i.e., point at which the surface
is sampled) is constant, and the most efficient algorithm must minimize the number of
such vertices.
In this work, the matrices N, and N~ are used to determine two vectors Numax and
Mr,max defined by the elements
Numax(i) = m a x [ N u ( i , j ) , j = 1 . . . . . nv],

and

Nvmax(i) = m a x [ N v ( i , j ) , j = 1 . . . . . nu],

where nu and nv represent the number of u spans and the number of v spans for this
surface. The result is a single extended grid covering the entire surface, instead of
separate grids covering each patch. This increases the number of vertices at which a
surface is sampled, and increases the resulting number of tessellants, but reduces the
cost per vertex by eliminating calculations which would need to be repeated for every
patch.
For example, the total number of values of the v parameter at which the v dependence
of the surface must be evaluated is reduced from

Nvl=Z[l+ZNv(i,j)]
j i

to

Nv2 = Z [ 1 + Nvmax(j) ].
J

Because of the direct product form of the NURB surface, the result of evaluating the v
dependence of the surface for these Nv2 values of the v parameter may be applied to
every span of the u parameter. In the conventional approach, the v dependence of the
surface must be re-evaluated for every u span. A similar savings is obtained for the u
parameter.
In the case of the surface shown in Fig. 5, the conventional approach divides the
surface into 157 uv rectangles requiring the evaluation of the v basis functions at 62
values of the v parameter and evaluation of the u basis functions at 61 values of the u
parameter. There is some redundancy within these sets of u and v parameter values, but
this redundancy is ignored when the patches are treated independently. The alternative
presented here results in a single global grid with 320 uv rectangles, but requires the
evaluation of the v basis functions at only 20 values of the v parameter and requires
evaluation of the u basis functions for only 25 values of the u parameter. In addition,
W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177 171

the use of a single grid covering the entire surface eliminates the need for "coving" or
other techniques for ensuring that adjacent patches meet at their common boundaries.
Additional savings are obtained when mapping the trimming curves onto the support-
ing surface. With the current approach, the trimming polygon must be clipped to each
u interval once for each surface. In the conventional approach, this clipping operation
would be repeated for every u span, because every u span has an independent set of
v intervals. In the example shown in Fig. 5, the single global grid requires only 16 v
intervals, while the conventional approach involves 58 v intervals.

5. Mapping trimming contours onto the supporting surface

In the current approach, the trimming polygons are mapped onto the tessellated
supporting surface after tessellating both the surface and the trimming contours. This is
in contrast to the conventional approach (Rockwood et al., 1989), where the trimming
contours are mapped onto the surface as the first step, the surface and the trimming
curves are then divided into patches, the trimming curves for each patch are then
tessellated, and finally the surface is tessellated in a manner which depends on how
the trimming curves have been tessellated. The conventional approach requires finding
roots of polynomials to determine where the actual trimming curves cross the patch
boundaries. The supporting surface is then evaluated independently within each patch
both for points determined by the tessellation of the trimming curves and for points
determined by tessellation of the supporting surface. Additional work ("coving") must
also be performed to glue the patches together.
The current approach avoids much of the redundant and unnecessary work required
by the conventional approach by tessellating the trimming curves once for the entire
surface. As a result, there is no need to solve polynomial equations to find where the
trimming curves cross patch boundaries. Instead of dividing a surface into uv patches, the
surface is divided into u intervals extending across the entire range of the u parameter,
as shown in Fig. 6a. The trimming polygon, a sequence of linear vectors determined
by tessellation of the trimming curves, is then clipped to each of the v intervals. This
operation determines the intersection of the trimming polygon with each v interval,
as shown in Fig. 6b. This is a simple one-dimensional clipping operation which can
be optimized for rejection because most of the trimming polygon lies outside most v
intervals. The resulting v-clipped trimming polygons tend to have a small number of
vertices compared to the global trimming polygon.
After clipping the trimming polygon to a v interval, the u parameter range is divided
into a sequence of u intervals determined by the values of Numax. One such u interval is
shown in Fig. 6b. The same set of u intervals is used for every v interval. The v-clipped
trimming polygon is then clipped to each u interval to form a uv polygon representing a
portion of the trimmed surface. This uv polygon contains four vertices determined by the
boundaries of the u intervals and v intervals, as well as additional vertices determined
by the original trimming polygon and points where the trimming polygon crosses the
boundaries of the u intervals and v intervals.
Coordinates, tangent vectors, and surface normals may then be calculated for the
172 W.L. Luken/ Computer Aided Geometric Design 13 (1996) 163-177

a.
!~liiiiii!!!Hii~iii!i[~ii~iii!~iiii

v interval

~iiiii!il]i~
,ii!iiiii!!~!!i~!iii~i!iiiii!i!i!i~
..°, li?iiliii?!iii?i?i

v interval

t
Fig. 6. (a) An interval in the v parameter extending across the entire surface. (b) An interval in the u
parameter intersecting the v-clipped trimming contours.

four points determined by the boundaries of each u interval and v interval (Luken,
1992; Luken and Cheng, 1993a; Luken and Cheng, 1993b). These four points determine
a uv rectangle. Each new u interval requires the calculation of only one new point, one
point is shared with the previous u interval, and two points are shared with the previous
v interval. The coordinates and normal vectors for any additional points determined by
the trimming polygon may then be determined by linear interpolation between the four
points determined by the current u v rectangle. This approach amounts to mapping the
trimming curves onto the tessellated supporting surface,
This is illustrated in Fig. 7, where quadrilateral ABCD represents the x y z coordinates
determined by a u v rectangle in the parameter space of some surface. Points E, F, G,
and H are located on a trimming contour which crosses this u v rectangle. Points e, f,
g, and h are determined by linear interpolation between points A, B, C, and D based
on the parametric coordinates of points E, F, G, and H respectively. Polygon ABChgfe
represents the portion of the trimmed surface associated with the region ABCD of the
corresponding untrimmed surface.
This region may also be represented by a fill area set consisting of two contours,
one defined by ABChDe and the second by efghD. In this case, the second contour
removes a portion of the area defined by the first contour. In order for this to be work
correctly, the first contour must include the points e and h in addition to the corners A,
B, C, and D. Although vertex h, for example, is nominally colinear with vertices C and
D, numerical precision errors can cause the numerical representation of this vertex to
deviate from the line joining the numerical representation of vertex C to the numerical
representation of point D. Adding vertex h to contour ABCD guarantees that edge hD
of contour efghD is exactly coincident with the corresponding portion of contour ABCD
W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177 173

I)

B
Fig. 7. Mapping a trimming contour onto a polygon (ABCD) determined by a uv rectangle.

in spite of numerical precision errors.


As an alternative to mapping the trimming curves onto the tessellated supporting
surface, it is possible to return to the true supporting surface defined by the surface
control points, weights, knot vectors, etc. Such an approach, however, is very costly
because evaluation of isolated points on a NURB surface is much more laborious than
either linear interpolation or evaluation of surface points on a regular grid. In addition,
the use of "accurate" coordinates for points on trimming curves is inconsistent with
the approximations used to represent the supporting surface. In order to be consistent,
the trimmed surface should represent a subset of the untrimmed supporting surface, as
approximated with the surface tessellation criteria. In other words, the surface tessellation
criteria define a decomposition of the untrimmed supporting surface into planar or
nearly' planar polygons. Any additional points on the surface not resulting from the
decomposition of the untrimmed supporting surface (e.g., points on trimming curves)
should be determined by the same algorithm used to render planar polygons, not the
original exact surface.
As a result of mapping the trimming curves onto an approximation to the supporting
surface, the boundaries of the trimmed regions are displaced from the "exact" locations
defined by the parametric equations for the supporting surface. For example, points E,
F, G, and H on the boundary of the trimmed region shown in Fig. 7 are displaced to
locations e, f, g, and h. This may lead to gaps or overlaps between pairs of trimmed
surfaces which are supposed to meet along a shared boundary. This is very important be-
cause trimming curves are typically determined by the intersection of pairs of parametric
surfaces. Consequently, for every trimming curve on a given surface, there is usually a
corresponding trimming curve on another surface. The magnitude of the displacement
of the boundary of a trimmed surface, e.g., EFGH to efgh, is controlled by the surface
approximation criteria, such as the chordal deviation criterion. The control values for
such criteria are typically chosen so that no points on the approximated surface deviate
from the exact surface by a noticeable amount (e.g., one pixel or less). In this case, the
points e, f, g, and h used to represent the boundary of a particular surface would never
deviate more than one pixel from the corresponding points E, F, G, and H on the exact
surface.
Even if the boundary of the representation of a particular surface is guaranteed to lie
within say 0.5 pixel of the corresponding points on the exact surface, it is unlikely that
such errors will be matched by the displacement of the corresponding boundary of the
174 W.L. Luken / Computer Aided Geometric Design 13 (1996) 163-177

other surface whose intersection with this surface is represented by this trimming curve.
Consequently, one pixel gaps or overlaps may be seen along the boundaries between
adjacent pairs of trimmed surfaces. Such artifacts, however, cannot be resolved simply
by using the exact points (E, F, G, H) instead of the approximations (e, f, g, h) unless
both surfaces which intersect along a particular boundary are sampled at exactly the
same points in 3d coordinate space. That is, points E, F, G, and H must represent points
on both surfaces which intersect along this boundary. This condition cannot be satisfied
unless both surfaces are considered simultaneously during the tessellation of the shared
boundary. This type of consideration, however, is impossible in the context of standard
3d graphics libraries such as PHIGS+ (van Dam, 1988) which require each surface to
be treated independently of any other surfaces.
Additional errors and rendering artifacts may result from the possibility that the trim-
ming curves provided with a particular parametric surface may represent approximations
to the exact polynomial functions arising from the intersection of two parametric sur-
faces. Although it is possible to find exact solutions describing the intersection of two
parametric surfaces, the results may require polynomials of high orders that are not
supported by a particular rendering library or modelling system. Consequently, it may
be necessary to approximate the exact trimming curves with polynomials of lower order.
In such a case, there is no point in producing an exact representation of the specified
boundaries, because the specified boundaries are themselves approximations to other
functions.
The task of rendering a trimmed NURB surface is not defined by finding the set of
pixels which form the most accurate possible representation of each surface. Rather,
this task is limited to finding a set of pixels which represent each surface within the
specified approximation criteria. If such criteria are chosen appropriately, the resulting
image will provide an accurate representation of each surface. In some cases, perhaps to
accelerate rendering performance, the approximation criteria may be deliberately chosen
so as to produce a crude representation of a trimmed surface. In such cases, the resulting
representation may exhibit noticeable flaws, and such flaws are to be expected as the
proper result of the rendering algorithm.

6. T h e curve handedness rule

Some 3d graphics interfaces, such as PHIGS+ specify that trimming contours must
be related to the interior of a surface by the curve handedness rule (van Dam, 1988).
The algorithms presented here for converting a trimmed surface into planar tessellants,
however, are completely independent of this restriction. The trimming contours may be
concave and nested. The may intersect each other or themselves. The direction of the
parametric coordinate is unimportant. The resulting polygons or fill area sets, however,
may be relatively difficult or inefficient to render.
For example, a hole may be cut in a trimmed surface by defining two nested contours,
an outer contour for the outer boundary of the surface, and an inner contour for the hole.
The region defined by the hole may be divided into a number of u v rectangles resulting
from tessellation of the supporting surface. Some of these u v rectangles may have no
W.L. Luken / Computer Aided Geometric Design 13 (1996) 163-177 175

vertices arising from the trimming curves. The resulting planar polygons consist of two
equivalent quadrilaterals. According to the odd winding rule, these entities have no area
and can be discarded. In principle, this condition can be detected and these entities can
be eliminated before they are processed by the polygon rendering facilities. The ease
and cost of detecting such conditions can be minimized by requiring the contours to
conform to the curve handedness rule. In this case, the curve handedness rule may confer
perfonaaance benefits. These benefits, however, are a function of the polygon rendering
process, not the process of decomposing a trimmed surface into polygons.

7. Comparison to other methods

A number of methods for rendering trimmed NURB surfaces have been presented
previously. In one method (Lane and Reisenfeld, 1980; Shantz and Chang, 1988),
NURB surfaces are rendered by drawing many curves spaced closely so that no pixels
are left unpainted. Each surface is first divided into patches and rendered on a patch by
patch basis. Adaptive forward differencing algorithms are used to generate the curves
and the coordinates of the pixels representing each curve. Trimming is accomplished
by limiting the extent of each curve to a range of determined by the path of the
trimming curves in parameter space. This method requires dividing trimming curves
into monotonic functions of the u parameter. The effects of lighting and shading are
approximated using a Hermite approximation. The result is a very slow algorithm which
does not exploit efficient area fill algorithms or specialized hardware for performing
shaded area fills. Many pixels may be generated redundantly in order to ensure that
none are omitted. The use of the Hermite approximation for the lighting and shading
functions may lead to a poor representation of the effects of lighting on the interior of
a patch (Luken and Cheng, 1993b).
The current methods are based on generating planar tessellants instead of closely
spaced lines. The current methods are not limited to the use of adaptive forward differ-
ence algorithms, and the current methods permit accurate representation of the effects
of lighting and shading at the interior points of a surface. The current methods do not
render surfaces on a patch-by-patch basis, and the current methods do not require the
trimming curves to be subdivided into monotonic functions of the u parameter.
Another method has been presented in which trimmed NURB surfaces are tessellated
into non-overlapping triangles (Rockwood et al., 1989). Like the previous work (Lane
and Reisenfeld, 1980; Shantz and Chang, 1988), the method of Rockwood et al. begins
by dividing a surface into patches and rendering each patch independently. This requires
splitting the trimming curves at patch boundaries and creating additional curves along
patch boundaries, as shown in Fig. 2 of (Rockwood et al., 1989). In addition, the
methods presented by Rockwood et al. require the calculation of all local minima and
maxima of the trimming curves, that is, all points where the tangents are parallel to
either the u or v axes. These points are needed to divide the trimmed region into "uv-
monotone regions". The methods presented in the current work require none of these
procedures. That is, the current work does not require splitting of trimming curves at
patch boundaries, the current work does not require the creation of new curves along
176 W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177

patch boundaries, the current work does not require calculation of local extrema on the
trimming curves, and the current work does not require dividing the trimmed region into
uv-monotone regions.
Like the current work, the methods of Rockwood et al. divide a surface into planar
tessellants which may be rendered efficiently using specialized hardware and area fill
algorithms. Unlike the current work, the methods of Rockwood et al. generate planar
tessellants consisting of non-overlapping triangles and quadrilaterals. The quadrilaterals
correspond to rectangles in parameter space and most of these are found to be convex,
very nearly planar, and easily decomposed into pairs of triangles. The current work
allows the planar tessellants to be arbitrary fill area sets which may be concave and which
may have overlapping subareas. Rendering such complex tessellants may require much
more work than rendering triangles and convex quadrilaterals, but most of the tessellants
generated by the current methods tend to be triangles and convex quadrilaterals anyway,
in spite of the fact that more complex tessellants are possible.
Non-trivial tessellants generated by the current methods may be rendered using the
same algorithms used to process similar complex fill area sets arising from any source.
Such algorithms are required to support standard 3d graphics libraries such as PHIGS+
(van Dam, 1988), and there is no reason to implement special algorithms such as those
of Rockwood et al. just for trimmed NURB surfaces. Non-trivial tessellants can be
generated in the current work only if the trimming curves themselves form a complex 2d
fill area set in the parameter space of the surface. After clipping the tessellated trimming
curves to the uv rectangles determined by tessellation of the supporting surface, most
of the resulting planar tessellants are much simpler than the original trimmed regions.
The worst case is when the entire surface supporting a complete set of trimming curves
is represented by a single uv rectangle. Even in this case, the overhead for triangulating
or otherwise simplifying the resulting region is no worse than if the surface had been
represented by an equivalent 3d fill area set in the first place.
Another method (Luken and Cheng, 1993a) is similar to the current work in that a
NURB surface is first divided into v intervals instead of uv patches. Unlike the current
method, the method of (Luken and Cheng, 1993a) uses lists of active edge lists to
identify the interior of the trimmed region. In addition, the method of (Luken and
Cheng, 1993a) depends on the curve handedness rule. The current methods do not use
lists of active edge lists and the current methods may be used with trimming curves
that violate the curve handedness rule. Other recent work (Luken and Cheng, 1993b)
compares various methods for evaluating surface coordinates and derivatives, but makes
no reference to trimmed surfaces or trimming curves. Another report (Cheng and Luken,
1992) presents methods for calculating the step sizes for tessellation of trimming curves
and NURB surfaces. Although the current work depends on having some means for
determining these step sizes, the particular choice of such means is not specified here.

8. Conclusions

An efficient algorithm for rendering trimmed NURB surfaces has been presented. This
algorithm decomposes a trimmed NURB surface into planar or nearly planar polygons
W.L. Luken/Computer Aided Geometric Design 13 (1996) 163-177 177

and relies on subsequent polygon rendering facilities to complete the rendering process,
The resulting polygons may be complex and concave, allowing these conditions to be
resolved independently of the surface tessellation problem. The number of polygons
produced by this algorithm for a given surface may exceed the numbers produced by
other algorithms, but this is offset by a reduced cost for each polygon. In addition, this
method eliminates a number of unneeded or redundant operations such as calculating
the intersections of trimming curves with patch boundaries, "coving", and calculating
surface coordinates and normal vectors at isolated points.

References

Catmull, E. (1974), A subdivision algorithm for computer display of curved surfaces, UTEC-CSc-74-133,
University of Utah, Departmentof Computer Science.
Cheng, E (1992), Estimating subdivisiondepths for rational curves and surfaces, ACM Trans. Graphics 11,
140-151.
Cheng, E, Jarmoczyk, J.W., Lin, J.-R., Chang, S.-S. and Lu, J.-Y. (1988), Automaticmesh generationbased
on vertex label assignment, University of Kentucky,Department of Computer Science, Technical Report
105-88.
Cheng, E, Jarmoczyk, J.W., Lin, J.-R., Chang, S.-S. and Lu, J.-Y. (1989), A parallel mesh generationalgorithm
based on the vertex label assignmentscheme, lntemat. J. Numer. Meth. Eng. 28, 1429-1448.
Cheng, E and Luken, W.L. (1992), Computing step sizes for the tessellation of trimmed NURB surfaces,
IBM Research Report RC 18499, Nov. 1992 (submitted to Computer Aided Geometric Design).
Cheng, E and Mehra, M. (1990), Label-drivensubdivisionand its applicationin piecewise surface generation,
University of Kentucky,Departmentof Computer Science,TechnicalReport 176-90.
Foley, J., van Dam, A., Feiner, S. and Hughes, J. (1990), Computer Graphics, Principles and Practice, 2nd
edition, Addison-Wesley,New York.
Lane, J.M. and Reisenfeld, R.E (1980), A theoretical developmentfor computer generation and display of
piecewise polynomialsurfaces, IEEE Trans. Pattern Anal. Mach. lntell. 2, 35-46.
Lien, S.-L., Shantz, M. and Pratt, V. (1987), Adaptive forward differencingfor renderingcurves and surfaces,
ACM Siggraph, Comput. Graph. 21, 111-118.
Luken, W.L. (1992), Methods for rendering NURBS surfaces, IBM Research Report RC 18498.
Luken, W.L. and Cheng, E (1993a), Renderingtrimmed NURB surfaces, IBM Research Report RC 18669.
Luken, W.L. and Cheng, E (1993b), Comparison of surface and derivative evaluation methods for the
rendering of NURB surfaces, IBM Research Report RC 18670, (submitted to ACM Trans. Graphics).
Rockwood, A., Heaton, K. and Davis, T. (1989), Real-time rendering of trimmed surfaces, ACM Siggraph,
Computer Graphics 23, 107-116.
Shantz.. M. and Chang, S.-L. (1988), Rendering trimmed NURBS with adaptive forward differences, ACM
Siggraph, Computer Graphics 22, 189-198.
van Dam, A. (1988), PHIGS+ FunctionalDescription,Revision 3.0, ACM Siggraph, Computer Graphics 22,
125--128.

You might also like