1988 - Rendering Trimmed NURBS With Adaptive Forward Differencing
1988 - Rendering Trimmed NURBS With Adaptive Forward Differencing
Abstract Introduction
Trimmed non-uniform rational B-splines have become a Several methods have been used previously for rendering
very useful surface representation form in the mechanical tr/mmed NURB surfaces. The de Boor Cox algorithm [4] is
CAD industry. Previous rendering methods use the de Boor frequently used for evaluating a B-spline curve or surface at
algorithm to evaluate the surface at equal increments in a particular point in parameter space. Also, subdivision
parameter space. This yields polygons which are then ren- techniques using knot insertion have been described by
dered. Alternatively the Oslo algorithm and Boehm's knot Boehm [2] and Cohen and others (the Oslo algorithrn)[6].
insertion algorithms are used in a subdivision approach. In The Oslo algorithm is capable of simultaneously inserting
this paper a new method is presented for rendering trimmed multiple knots in an efficient manner. A simple proof of the
NURB surfaces of arbitrary order using the adaptive forward Oslo Algorithm is given by Prautzsch[13], and a more
differencing (AFD) technique. This method extends the efficient way of using the Oslo algorithm is given by Lyehe
AFD technique to higher order, efficiently computes the and Morken[12]. Lee [10] gives an algorithm for evaluating
basis matrix for each span, calculates the shading approxi- the derivatives of a NURB at a point in parameter space by
mation functions for rational surfaces, and trims and image using knot insertion. Boehm [3] later derived a more
maps NURB surfaces. Trimming is accomplished by using efficient scheme for the simultaneous evaluation of all sur-
AFD to scan convert the trimming curves in parameter face derivatives at a point in parameter space.
space, thus producing the intersection points between the Nonuniform B-spline curves and surfaces can be rendered by
trim curves and an isoparametric curve across the surface. A tesselation to piecewise linear vectors or planar polygons by
winding rule is used to determine the regions bounded by the evaluating at intervals in parameter space. They may also be
curve which are then rendered with AFD. The method is subdivided to produce vector or polygon vertices or subdi-
suitable for both hardware and software implementations, vided to individual pixels. Each of these methods has cer-
however, higher order surfaces require very high precision tain drawbacks. Subdividing using knot insertion down to
due to the forward difference nature of the algorithm. the pixel level is very expensive. Piecewise planar methods,
while fast, yield lower quality renderings if done coarsely
and make image mapping and trimming more difficult.
CR Categories and Subject Descriptors: 1.3,3 [Computer The approach presented in this paper involves obtaining the
Graphics]: Picture/Image Generation - Display algorithms; functional description of each span by computing the basis
1.3.7 [Computer Graphics]: Three-dimensional Graphics function of the span, then rendering the span using the adap-
and Realism - Color, shading, shadowing, and texture. tive forward difference technique together with a Hermite
shading function approximation.
Additional Key Words and Phrases: image synthesis, shad- In this paper the AFD technique is extended to higher orders
ing, adaptive forward differencing, graphics VLSI, and used to evaluate the NURB surfaces and their associated
parametric surfaces, B-splines, NURBS. trimming curves incrementally. A recursive relation is
derived for obtaining the coefficients of the basis functions
for a given knot vector, and a method is given for computing
Permission to copy without fee all or part of this material is granted shading function approximations for a rational surface. AFD
provided that the copies are not made or distributed for direct is also used to evaluate the NURB trimming curves in
commercial advantage, the ACM copyright notice and the title of the parameter space "scanline" order to provide the parameter
publication and its date appear, and notice is given that copying is by bounds for rendering curves across the surface. Figure 3
permission of the Association for Computing Machinery. To copy shows a result produced with these techniques, an image of
otherwise, or to republish, requires a fee and/or specific permission.
trimmed NURB surfaces with image mapping and shading.
189
/ SIGGRAPH '88, Atlanta, August 1-5, 1988
Bo= 1, B 1= t, Bz= t t ~
2
..B, = t(t'71)(t-2) "'" (t-n+l)
DUff
[!ooo
coefficients in the u and v direction to the appropriate initial
forward step size. For nth order this matrix is simply
du 0 0
0 du 2 0
0 0 du ~
. .
, / 2 -1,'8 1 / | L-1 = The scaling matrix can be trivially extended to higher order
o 1/4 - l ~ j by filling in the jth diagonal elements with duJ, where du is
the amount of scaling.
190
~ ComputerGraphics,Volume22, Number4, August 1988
~1/2 0 0
W= 0 0 0
We note here that the F D matrix for higher order can be o 1/8
computed from an expression
a o + a l u ,-I- a 2 u 2 + ... + a d ud = The adjust-down operation is extended to higher order by
u... ( u - d + l ) L = [FD ] [W] [FD-~].
b ° + b l u +b2 + "'" +bd d!
where the [FD-I] matrix converts the forward difference
which relates a set of forward difference basis coefficients
coefficients into polynomial basis, the [W] matrix scales the
<b~> to the corresponding polynomial basis coefficients
polynomial coefficients by 0.5, and [FD] converts the scaled
<aj > :
result back into forward difference basis again. For order 5
b 0= a 0 the adjust down matrix is
'I'
b~ = Ig Ig(-lI~-~Cl k~ a~
j = l l *=O
1
J
where C~ i----L--
k !(i-k)t
arid d = degree Ii °°°
0
0
0
0
118
0
-3/32|
1/16 ]
[00000!j
i
FO~j= E(-1)~-~c~k j The adjust-up matrix can be similarly extended by
k=0
FD=
11000i]
For example the FD matrix for order 5 is
• 0l l t2 6 ,4
L-1= [FD I [UI [FD-1], where U = 00
[!ooo
00636
0002 To increase the distance between two curves the matrix A is
transformed by L-t. For order 5 the adjust up matrix is
The resulting forward difference matrix A can then be calcu-
lated by concatenating all the matrices appropriately.
210
A =[FD] [DUI [CU] [P] [CV]r [DV]r [FD] r L-I= 0 4 4
008
000163
4. The f o r w a r d step operation
Notice that above order 4 the adjust down matrix contains
The forward step operation [E] is mathematically a linear values which are not powers of two. Up to order nine, the
substitution of v + l for the parameter v. Practically it is used elements can all be represented as the sum of two powers of
to advance from the current curve to the next or from the two.
current pixel to the next. This operation can be extended
trivially to higher order. In the forward difference basis a
forward step is performed for all coefficients by adding the
i+l coefficient to the ith coefficient Thus the [E] matrix can Obtaining NURB basis functions
be generalized as Trimmed NURBS have become a useful surface representa-
E i j = 1 if i=j or j=i+l, otherwise 0 tion form in the MCAD industry[l]. Uniform splines have
constant basis functions throughout the spans, i.e. the basis
The forward step matrix for nth order is matrix is the same for all spans. Non-uniform splines
instead have a different basis function for each span defined
I,°° 101 .., oil recursively by a knot vector. A B-spline curve is a piece-
wise polynomial curve
. . . . 0 f ( ~ ) = E p~M(")
i
191
/ SIGGRAPH '88, Atlanta, August 1-5, 1988
are piecewise polynomial of order k defined over a knot vec- Rational Shading Approximation
tor • • • < u 0 < u 1 < u 2 < • - - by a recursive relation A shading function approximation method for non-rational
surfaces was presented in a previous paper by the authors
Nil(u)=0 if u e [ul,u~÷l]
[15]. This method uses Hermite approximation to approxi-
N i l ( u ) - - 1 if u e [ul,ui+l] mate the normalized shading functions N'L and N ' H with
two bicubic functions.
N~(u) "-ul N~_lfu) + u.~-. N~l(u ) The shading approximation algorithm for rational surfaces is
Ui+k-l--I~i Ui+k--Ui+1
very similar to that described previously. The derivation o f
B o e h m ' s triangular scheme operates on the knot vectors and the shading function approximation for rational surfaces is
control points to give the values and the derivatives o f the included in Appendix B.
coordinate functions xyzw. This scheme can then be used to The calculation of derivatives o f rational functions are gen-
obtain the polynomial coefficients for each span o f the sur- erally more complex. The implementations o f the two algo-
face and to calculate the normal vectors and the bicubic Her- rithms are the same except at the low level routines where
mite approximations o f the shading function for a surface. the derivatives are computed. Here only the differences
An alternative method is presented here which operates on between the two are outlined.
the knot vectors to give the basis matrices o f each span For a non-rational surface
which then convert the control points for the span to polyno-
mial or forward difference basis. x ( u , v ) = UXV, y (u,v ) = UYV, z(u,v )= UZV
To render the surface with the A F D technique, the parameter the low level derivatives are
u for a current span (ut,um) is redefined to range between 0.0
ax - u ' x v ,
~u T~x
v = uxv', °2x ~ = u"xv,
~u.---
and 1.0 by a linear substitution u' = ut+lu + (1-u)ul so that
192
~ ComputerGraphics,Volume22, Number4, August1988
3. Computation Complexity
,, The de Boor algorithm is popular for evaluating points on a
vlrrl.ln max
NURB surface, or inserting knots in a subdivision technique
for surface rendering. A full version of the de Boor algo-
rithm for evaluating a point on a surface of order k requires
(k-1)k(k+l)/2 multiplies and twice as many adds. This makes
193
SIGGRAPH '88, Atlanta, August 1-5, 1988
spline function, which is k(k-l) multiplies and adds. For a 5. Transparency and Anti-aliasing
bi-variate function, it would require 4k triangle operations to Redundant pixel painting in AFD constitutes the major obs-
compute all the derivatives, which is 4k2(k-l) multiplies and tacle in rendering transparent objects. Quick solutions to get
adds. Given the derivatives, k z multiplies are required to around the redundant pixel problem would be either to
compute the polynomial coefficient matrix. The method tesselate a transparent object into polygons or to keep a
presented here takes approximately 4k + 4(k-1)(k-2) + buffer for object identification at each pixel to eliminate
(k-1)(k-2)(21c-3)/6 multiplies and adds to compute a basis redundancy. However, the object-id buffer still can not han-
function of order k, assuming the knot differences have been dle a folded surface. A new twin-curve buffer algorithm is
precomputed. This method requires the computation of all under development by the author to tackle this problem. Still
the basis functions in the u, v direction. Given the basis more work and testing are required.
functions, it takes two kxk matrix multiplies to produce a
One very successful anti-aliasing technique is based on dic-
polynomial coefficient matrix, which is 2k3 multiplies and
ing to produce micropolygona [1] followed by skittered sub-
~z(k-1) adds per span. The computational complexity of the
sampling and averaging. Previous methods for dicing used
two methods is similar. Boehm's method operates on the
screen space derivatives to determine how finely to dice, and
control points directly instead of computing the basis func-
ordinary forward differencing to do the actual dicing. The
tions for each span, and thus has more memory requirement.
AFD technique may have potential as a method for dicing
since screen space step size is the condition which controls
4. Error Analysis adjust up, adjust down, or forward step. Further investiga-
Although forward differencing is the fastest possible way to tion in this area is needed.
sample a large numbers o f points on a surface, it tends to be
more vulnerable to errors than other evaluation methods.
After performing k forward step operations on a cubic func-
tion f(t)--aBa(t)-bbBz(t)+cBt(t)-bdBo(t), the four coefficients
become .a ' = a k(k-1)(k-2)
~ "+O----~---+CX. c,=ak(~+bk+c,
_k(k-1) . .+a, Conclusion
b'=ak+b, and a'=a. The error accumulation in each In this paper a technique for rendering nonuniform rational
coefficient is formulated as B-spline surfaces is described. The A F D technique is gen-
eralized to higher order, and a recursive relation is derived
k (k- 1)(k-2) +eb ~ + e c k -be d for efficiently computing the basis function coefficients of a
Ea'=e~- 6
NURB surface. An approximation method for computing
E c" = e a ~ - ~ - b e b k -bee the shading functions of a rational surface is developed and
A F D is applied to the problem of trimming NURB surfaces
Eb • = eak+el~ with NURB trim curves using a method similar to polygon
Ean -- ~a scanline algorithms. A F D based rendering methods for
NURBS give the quality of subdivision methods with the
where e,,eb,ec and ed are the initial errors in the coefficients efficiency of forward difference techniques. Image mapping
and E,,E~,Ec and Ed are the errors accumulated after k steps. and NURB trimming are also facilitated. Figure 6 shows a
In fixed point arithmetic with all the coefficients having clevice rendered using these techniques.
equal number of fractional bits, the term eak(k-l)(k-2)16 con- The shading approximations and the re.cursive relation for
tributes the most to the error, which can be as much as 30 computing basis functions are equally applicable to other
bits for k=21°. For higher order functions the error can accu- rendering techniques such as polygon tesselation, ordinary
mulate even more rapidly. Both OFD and AFD techniques forward differencing, or recursive subdivision.
suffer error propagation problems, however, the AFD error is
Further work should be done on evaluating the accuracy of
always bounded by the O F D error. The number of steps
the Herrnite approximation functions for shading and possi-
required by OFD to forward across a curve is always greater
than or equal to that of AFD, because OFD uses the bly extending these methods to higher order.
minimum step size while A F D can adjust up step size
whenever needed and thus reducing the number of steps. An
adjust-up operation cuts the number of forward steps in half,
and at the same time requires an n-bit left-shift in the ease o f
a degree-n function. It is clear from the dominating error Acknowledgement
term in the following relation that the AFD error with k for- The authors would like to thank Lewis Knapp and David
ward steps following an adjust-up is always smaller than the Elrod for aquiring the NURBS data bases and writing the
OFD error with 2k forward steps. database reader software. Thanks to Tony Wyant for provid-
ing the digitized images for mapping, and to Sue Carrie for
e, 2k(2k-l)(2k-2) >2ae° k (k-1)(k-2)
6 6 helpful discussions on error analysis. We are grateful to
Lewis Knapp for reviewing early drafts of this paper and for
A section of error analysis on the OFD technique can also be many helpful discussions. Special thanks to Automation
found in Rockwood's paper. Technology Products for providing trimmed NURB data.
194
4~ ComputerGraphics,Volume22, Number4, August 1988
Appendix A Appendix B:
This appendix derives the NURB forward difference basis This appendix describes how to compute the derivitaves for
function for a single span from the knot vectors. the Hermite shading function approximations for the r a t i o n a l
W e can redefine the B-splint function N~ in forward differ- case. A rational bicubic patch is defined by
ence basis as X ( u , v ) = -U X V x (u ,v)
w(u,v)
UYV y(u,v)
YCu,v) =
+ .-- + B~_~ u (u- 1)(u-2)...(u--(k-2)) UWV- w(u,v)
(k-Dr UZV z (u,v )
zcu,v) = = - -
UWV w(u,v)
and
where x(u,v), y(u,v), z(u,v) and w(u,v) are the nonrational
B:, [1 ui~u<u~+t and j=0 polynomial functions describing the coordinates of a patch.
J,I = 0 otherwise
The jth coefficient B:j o f the NURB basis function N~ in the The normal vector N = <n+,%,n, > is given by
forward difference basis for the ith span of a curve of order k .~=Y.Z.-Y,Z., %=z.x,-z,x., n,=x. Y,-X. Y.
is given by
The derivatives o f the unnorrnalized normal vector function
BEd = J• Bi~-t
d-I + t . / _ , , ) n ~ 2 1 j Bi+l,i_1
k-i + (.j-ui+~)Bi+lj
. k-1
are given by
U i+k-l--t~i gi-+.k--Ui+l
3n~
au = r . z . + Y.ZZ~- r ~ z . - r . z . ,
Derivation:
F r o m the B-spline basis definition we notice that N~(u) 3n.
is the sum o f two products o f a linear equation times a ~, = r . z , + Y . Z . - r . z . -rvz+
polynomial. a2n~
N~(u )=(au+b )Ni~-t + (a"u +b')N~.it ~uOv - Y.~,Z. + Y . Z . + Y . Z ~
B u(u-1) [.3_q..~.u__~_+3(b+2a)] 1
X~, = - ~ - ( w x ~ , - w x w ~ , - 2 w w . x . +2xw. w . )
Grouping common terms and repeating similarly for the X.,, - H2(u,v) - 3 X . ( u , v ) - - w.
w 3 W
second product gives
where
Substituting for a and b gives the equation of the recursive H l(u,v ) ffi"~(w 2x~-wxwu.u-2wwux.+2XWuWu)
~lation.
H2(u,v) = -~-(w zx~,~-wxwv,-2w%x,,+2xw, wv)
195
/ S I G G R A P H '88, Atlanta, A u g u s t 1-5, 1988
III I
References
The derivatives and the cross derivatives in the u and v
1. Richard Barrels, John Beatty, and Brian Barsky, An
directions are given by
Introduction to Splines for use in Computer Graphics
O~(u,v) anx ~ aG and Geometric Modeling, Morgan Kaufmann Publish-
=
au au ~j + ' ~ U fix ers, 1987.
2. Wolfgang Boehm, Inserting New Knots into B-Spline
av = av G+'~ "n" Curves, 12, pp. 199-201, Computer Aided Design,
1980.
aua~ = a ~ a + -E~" + ~.x + au a, 3. Wolfgang Boehm, E3ficient Evaluation of @lines, 33 ,
pp. 171-177, Computing, 1984.
aG
~-E =_.Gs (n=-an=
E + n' -any
E + ' " ~an.
-) 4. Carl de Boor, On calculating with B-splines, 6, pp. 50-
62, Journal of Approximation Theory, 1972.
aG = ._G3 an= a% an. 5.
(n=-5;:+~,--E+n,-~;-) Edwin Catmull, A Subdivision Algorithm for Computer
Display of Curved Surfaces, UTEC-CSe-74-133,
University of Utah, Computer Science, 1974.
a,,,~; GLa, J . Elaine Cohen, Tom Lyche, and Richard Riesenfeld,
Discrete B-Splines and Subdivision Techniques in
-L. [ n . - ~ + ~ a~v +n. auavj Computer-Aided Geometric Design and Computer
Graphics, 14, Computer Graphics and Image Process-
: an, an= a% a% an, an, ] ing, October 1980.
7° Robert Cook, Patch Work, Tech. Memo 118, Computer
To approximate the unit normal vector function w e n e e d Div., Lucasfilm Ltd., June 1985.
8. Robert Cook, Loren Carpenter, and Edwin Catmull,
ale, The Reyes Image Rendering Architecture, SIG-
~t,(o,o) ,f,(o,D -~-(o,o) .-~-(0,1)
GRAPH'87 Proceedings, July 1987.
~t=(Lo) ~,(LD -~-(LO) --~-O,D . James Foley and Andries Van Dam, Fundamentals of
:== Interactive Computer Graphics, p. 533, Addison-
-~-(o,o) -E(O,l) .~.(o,o) ~.~.(o,1~ Wesley Publishers, 1982.
10. E.T.Y. Lee, Ej~cient Evaluation of Splines, 329, pp.
apt.,, a~ a% a2,t, 365-371, Computing, 1982.
~-(1,0) --~-(|,1) -~-(t,O) a~v(l,ll
11. Sheue-Ling Lien, Michael Shantz, and Vaughan Pratt,
Adaptive Forward Differencing for Rendering Curves
and Surfaces, SIGGRAPH'87 Proceedings, July 1987.
12. Tom Lyche and Knut Morken, Making the OsIo Algo-
rithm More Ef~cient, 23, pp. 663-675, SIAM J. Numer.
Anal, 1986.
13. Hartmut Prautzsch, A Short Proof of the Oslo Algo-
rithm, 1, Computer Aided Geometric Design, 1984.
14. Alyn Rockwood, A Generalized Scanning Technique
for Display of Parametrically Defined Surfaces, 7,
IEEE CG&A, August 1987.
15. Michael Shantz and Sheue-Ling Lien, Shading Bicubic
Patches, SIGGRAPH'87 proceedings, July 1987.
196
~ ComputerGraphics,Volume22, Number4, August 1988
Figure 4. Two rational biquadratic surfaces shaded with a 4th order non-rational
shading approximation function. Left) Non-degenerate surface. Right) Degenerate
surface with one degenerate edge. Two light sources were used.
197
SIGGRAPH '88, Atlanta, August 1-5, 1988
Figure 5. Nut composed of trimmed planes cylinders and cones. The beveled rim
portion is a trimmed cone.
198