0% found this document useful (0 votes)
124 views

Computer Graphics 17 - Curves and Surfaces 2: Tom Thorne

This document discusses techniques for modeling curves and surfaces in computer graphics, including Bézier curves, B-splines, de Casteljau's algorithm, and de Boor's algorithm. De Casteljau's algorithm provides a precise method for evaluating points on Bézier curves of any degree. B-splines define curves using basis functions and control points, with the knots defining the curve's domain. De Boor's algorithm is the B-spline equivalent of de Casteljau's algorithm for evaluating points precisely. The document provides examples of using these techniques to define and evaluate curves.

Uploaded by

vishwajeet patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Computer Graphics 17 - Curves and Surfaces 2: Tom Thorne

This document discusses techniques for modeling curves and surfaces in computer graphics, including Bézier curves, B-splines, de Casteljau's algorithm, and de Boor's algorithm. De Casteljau's algorithm provides a precise method for evaluating points on Bézier curves of any degree. B-splines define curves using basis functions and control points, with the knots defining the curve's domain. De Boor's algorithm is the B-spline equivalent of de Casteljau's algorithm for evaluating points precisely. The document provides examples of using these techniques to define and evaluate curves.

Uploaded by

vishwajeet patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Computer Graphics 17 - Curves and Surfaces 2

Tom Thorne

Slides courtesy of Taku Komura


www.inf.ed.ac.uk/teaching/courses/cg
Overview

• More on Bézier and B-splines

• de Casteljau’s algorithm

• General form of B-splines

• de Boor’s algorithm

• Knot insertion

• NURBS

• Subdivision surfaces
De Casteljau’s
de Casteljau’s algorithm Algorithm
• A method totoevaluate
• A method (sample
evaluate (sample pointspoints in)aor
in) or draw draw
Bézier
the Bezier
curve curve
• The Bezier curve of any degree
• Works with Bézier curves of any degree
can be handled
• A precise way to evaluate the curves
• A precise method to evaluate the curve
de Casteljau’s algorithm
de Casteljau’s Algorithm
• • Given the control points P1 , . . . , Pn and the parameter value
0t1
• Repeat the following procedure:
Pir (t) = (1 t)Pir 1 r 1
(t) + tPi+1 (t)
Pi0 (t) = Pi
n
• Then P0 (t) is the point with parameter value t on the
Bézier curve
Why does this work?

• In the quadratic Bézier curve case with 3 control points, P0 , P1 , P2

1
P0 (t) = (1 t)P0 + tP1
1
P1 (t) = (1 t)P1 + tP2
2 1 1
P0 (t) = (1 t)P0 + tP1

• By inserting the first two equations into the third we obtain

P02 (t) = (1 t)2 P0 + 2t(1 t)P1 + t2 P2


• Doing this for 4 control points will give the cubic formula we saw
last week
Why do we need this?

Why do we need this?


• The explicit representation can result in some instability
• The explicit representation (monomial form) that I
presented last week can result in some instability
• Control points are randomly changed by 0.001
• Say the control points are randomly changed for
0.001.
• The curve from de Casteljau’s algorithm stays almost the
• The curve computed by the de Casteljau’s algorithm
same stays almost the same.
• The curve by the polynomial basis form can deviate
• The curve
from from the polynomial
the original curve if basis form can
the degree deviate from
is high
the original curve if the degree is high
Connecting Bézier patches

Connecting many Bezier Patches in


• The same thing applies to the polynomial form
patches
• The same story applies to surfaces
• The degree of •theThesurface
degree canofeasily
surface can easily go high, as
become high since it are
they is the
the multiplication of two curves
multiplication •ofBicubic
two curves,
→ 6 e.g.
Bicubic is of degree
• The 6error of 16
control points will
• The error of 16becontrol points is
accumulated
accumulated
Overview

• More on Bézier and B-splines

• de Casteljau’s algorithm

• General form of B-splines

• de Boor’s algorithm

• Knot insertion

• NURBS

• Subdivision surfaces
B-Splines: general form

a B-spline of order k (polynomial of degree k-1) is a parametric


curve composed of a linear combination of basis B-splines Bi,k :
m
Pi (i = 0, . . . , m) are the control points
p (t ) = ∑ Pi Bi ,k (t )
i =0

Knots: t0 ≤ t1 ≤ ... ≤ t k + m - the knots subdivide the domain


of the B-spline curve into a set of knot spans [ti , ti+1 )
The B-splines can be defined by
$1, t i ≤ t < t i +1
Bi ,1 (t ) = #
" 0, otherwise
t − ti ti + k − t
Bi ,k (t ) = Bi ,k −1 (t ) + Bi +1,k −1 (t )
ti + k −1 − ti ti + k −1 − ti
B-spline basis
Bspline Basis
B-spline basis
Bspline Basis (2)
Producing curves using B-splines
Producing Curves by B-Splines
• The basis functions are multiplied by the control points to
•define
The basis functions
arbitrary curves
are multiplied to the control
points and to define arbitrary curves

0 t
10/10/2008
3
Lecture 5 m+1
Knots

• The knots produce a vector that defines the domain of the


curve Knots
• The knots produce a vector that defines the
• domain
The knots mustofbe
theincurve
increasing order
• The knots must be in the increasing order
• Not necessarily uniform spacing
• But not necessarily uniform
• If uniformly sampled and the degree is 3
• uniform
If uniformly cubic and
sampled bspline
degree is 3 we have a uniform cubic
B-spline

0 1 2 3 4 5 6 7 8 9 10 11 12 13

knots
Knots
Knots
• Non-uniform knots:
Here is an example of non-uniform knots

http://i33www.ira.uka.de/applets/mocca/html/noplugin/BSplineBasis/AppBSplineBasis/index.html
B-spline terms

• Order k : the number of control points affecting the sampled value


Some Terms
• Degree k• 1 : the degree of the basis function polynomial
Order k: the number of control points that affect the sampled
value
• Control points Pi i = (0, . . . , m)
• Degree k-1 (the basis functions are polynomials of degree k-1)
• Knots t•j Control
(j =points
0, . .Pi. ,(i=0,…,m)
n)
• Knots : tj, (j=0,…, n)
• An important rule: n m=k
• An important rule : n – m = k
• • The
The domain of the curve isof t
domain k 1 tk-1
function t≦  t t≦tm+1
m+1
– Below, k = 4, m = 9, domain, t3 ≦ t ≦t10
• Below, k=4, m=9, domain is t3  t  t10

0 t
3 m+1
Clamped B-splines
• The first and last knot values are repeated with multiplicity
equal to the order (degree + 1)

• The end points pass the control point

• For cubic bsplines, the multiplicity of the first / last knots


must be 4 (repeated four times)
Controlling the shape of B-splines

• Moving the control points is the most obvious way to control


bspline curves

• Changing the position of control point Pi only affects the


interval [ti, ti+k), where k is the order of a B-spline curve
– Editing the shape through the knot vector is not
very intuitive
Overview

• More on Bézier and B-splines

• de Casteljau’s algorithm

• General form of B-splines

• de Boor’s algorithm

• Knot insertion

• NURBS

• Subdivision surfaces
de Boor’s algorithm
De Boor’s Algorithm
• B-spline version of de Casteljau’s algorithm

• A precise method to evaluate the curve

• Starting from control points and parameter value t,


recursively solve:
Example


Example
Assume we have a cubic B-spline with knot vector:
• Assume we have a cubic
[0, 0, 0, 0, 0.25, 0.5, 0.75, 1, 1, 1, 1] B-spline whose knot

vector is {0, 0,
Computing the point at t = 0.4 0, 0, 0.25, 0.5, 0.75, 1, 1, 1, 1}
• Let’s compute a point at t = 0.4
• Then t4 •Then,
t  t5t4 and
< t <the
t5, control
and the control
points points
that affectthat
the final
affect the final position are P4, P3, P2, P1
position are P4 , P3 , P2 , P1
Example
Example
• Assume we have a cubic B-spline whose knot
vector is {0, 0, 0, 0, 0.25, 0.5, 0.75, 1, 1, 1, 1}
• Let’s compute a point at t = 0.4
• Then, t4 < t < t5, and the control points that
affect the final position are P4, P3, P2, P1
Example

Example
• Assume we have a cubic B-spline whose knot
vector is {0, 0, 0, 0, 0.25, 0.5, 0.75, 1, 1, 1, 1}
• Let’s compute a point at t = 0.4
• Then, t4 < t < t5, and the control points that
affect the final position are P4, P3, P2, P1
Example
Example
• Assume we have a cubic B-spline whose knot
vector is {0, 0, 0, 0, 0.25, 0.5, 0.75, 1, 1, 1, 1}
• Let’s compute a point at t = 0.4
• Then, t4 < t < t5, and the control points that
affect the final position are P4, P3, P2, P1
What if you want to edit some details?
What if you want to edit some
details?
• You •might want to
You might addto
want some
addhigh
some resolution details indetails
high resolution a
at aarea
particular particular
whilst area while
leaving the keeping thecurve
rest of the rest unchanged
the same
Knot insertion

• We can do this by knot Insertion

• New knots can be added without changing the shape of the


curve

• Because of the basic rule n-m = k (n+1: number of knots, m


+1: the number control points, k: order) the number of
control points will also increase
Knot insertion

• For a curve of degree f we remove f-1 points and add f points

• i.e. for a cubic B-spline, remove 2 points and add 3 points


Knot insertion

• If the new knot t is inserted into the span [tj, tj+1),


the new control points can be computed by
Q i = (1 − ai )Pi −1 + ai Pi
where Qi is the new control point and ai is computed by
t − ti
ai = for j-k + 2 ≤ i ≤ j
ti + k −1 − ti
Pj-k+1, Pj-k+2, ..., Pj-1, Pj is replaced with Pj-k+1, Qj-k+2, ...,
Qj-1, Qj ,Pj.
Example

• A bspline curve of
degree 3 (k=4) having t0 to t3 t4 t5 t6 t7 t8 to t11
the following knots
0 0.2 0.4 0.6 0.8 1
• t=0.5 inserted
t0 to t3 t4 t5 t6 t7 t8 t9 to t12

0 0.2 0.4 0.5 0.6 0.8 1


Example

• A bspline curve of
degree 3 (k=4) having Example
t to t 0t 3 t 4 5 t6 t7 t8 to t11
the following knots
• A bspline curve of 0
t to t t
0.2
t
0.4
t
0.6
t7
0.8
t8 to t11
1
• t=0.5degree
inserted
3 (k=4) having
0 3 4 5 6

0 0.2 0.4 0.6 0.8 1


the following knots t to t t t t t7 t8 t9 to t12
0 3 4 5 6

• t=0.5 inserted t to t 0
t t 3
t 4
t 5 6 7
t8 t9 to t12
00 0.2 0.40.40.5 0.5
0.2 0.6 0.6
0.8 0.8
1 1
Example

• A bspline curve of
degree 3 (k=4) having
t0 to t3 t4 t5 t6 t7 t8 to t11
the following knots
0 0.2 0.4 0.6 0.8 1
• t=0.5 inserted
t0 to t3 t4 t5 t6 t7 t8 t9 to t12

t − t5 0 .5 − 0 .4 1 0 0.2 0.4 0.5 0.6 0.8 1


a5 = = =
t8 − t 5 1 − 0 .4 6
t − t4 0 .5 − 0 .2 1
a4 = = =
t7 − t 4 0 .8 − 0 .2 2
t − t3 0.5 − 0 5
a3 = = =
t 6 − t 3 0 .6 − 0 6

http://i33www.ira.uka.de/applets/mocca/html/
noplugin/curves.html
Summary of B-splines

• Knot vector defines the domain

• Evaluation by de Boor’s algorithm

• Controlling the shape by the control points

• Clamping the points by increasing the multiplicity of the


knots at the end points

• Increase the resolution by knot insertion


Overview

• More on Bézier and B-splines

• de Casteljau’s algorithm

• General form of B-splines

• de Boor’s algorithm

• Knot insertion

• NURBS

• Subdivision surfaces
NURBS (Non-uniform rational B-spline)

• Standard curves/surface representation in computer aided


design n

∑B
i =0
i ,k (t ) wi Pi
C (t ) = n

∑B
i =0
i ,k (t ) wi

Pi : control points
Bi,k : Bspline basis of order k
wi : weights
Benefits of using NURBS

• More degrees of freedom to control the curve (can control the


weights)

• Invariant under perspective transformation


– Can project the control points onto the screen and interpolate
on the screen
– Don’t need to apply the perspective transformation to all the
points on the curve

• Can model conic sections such as circles, ellipses and hyperbolas


Example of changing weights

• Increasing the weight will bring the curve closer to the


corresponding control point
B-spline Surfaces

• Given the following information:


• a set of m+1 rows and n+1 control points Pi,j where 0  i  m
and 0  j  n
• Corresponding knot vectors in the u and v direction,

m n
p (u , v) = ∑∑ Bi , p (u ) B j ,q (v)Pi , j : non − rational B - spline
i =0 j =0
m n

∑∑ w
i =0 j =0
i, j Bi , p (u ) B j ,q (v)Pi , j
p (u , v) = m n
: NURBS
∑∑ w
i =0 j =0
i, j Bi , p (u ) B j ,q (v)
Clamped, Closed and Open B-spline Surfaces

• Since a B-spline curve can be clamped, closed or open, a B-spline surface can also have
three types in each direction.

• That is, we could ask to have a B-spline surface clamped in the u-direction and closed in
the v-direction.

• If a B-spline is clamped in both directions, then this surface passes though control points
p0,0, pm,0, p0,n and pm,n

• If a B-spline surface is closed in one direction, then the surface becomes a tube.

• Closed in two direction : torus


– Problems handling objects of arbitrary topology, such as a ball, double torus
Overview

• More on Bézier and B-splines

• de Casteljau’s algorithm

• General form of B-splines

• de Boor’s algorithm

• Knot insertion

• NURBS

• Subdivision surfaces
Subdivision Surfaces

• A method to model smooth surfaces


3D subdivision surface

• Start with a rough shape first and subdivide it recursively


• Stop when the shape is smooth enough
• Used for modelling smooth surfaces
Motivation

• Shape modeling
– Topological restrictions of NURBS
surfaces
• Plane, Cylinder, and Torus
• It is difficult to maintain smoothness at
seams of patchwork.
– Example: hiding seams in Woody (Toy Story)
[DeRose98]
– NURBS also require the control nets
consist of a regular rectangular grid of
control points

• LOD in a scene
– A coarse shape when far away, a smooth
dense surface when closer to the camera
Subdivision surface
• Can handle arbitrary topology

Different Schemes
• Doo-Sabin ‘78
• Catmull-Clark ‘78
• Etc (Loop, Butterfly, and many others)
A Primer: Chaiken’s Algorithm

P2 3 1
Q2 Q3 Q0 = P0 + P1
P1 4 4
Q4
Q1 1 3
Q1 = P0 + P1
Q5 4 4
Q0
P3 3 1
P0 Q2 = P1 + P2
4 4
1 3
Apply Iterated Q3 = P1 + P2
Function System 3 1 4 4
Q2i = Pi + Pi +1
4 4
1 3 3 1
Q2i +1 = Pi + Pi +1 Q4 = P2 + P3
4 4 4 4
1 3
Q5 = P2 + P3
4 4

http://www.multires.caltech.edu/teaching/demos/
Limit Curve Surface
java/chaikin.htm
Doo-Sabin Subdivision
• An edge point is formed from the midpoint of each edge
• A face point is formed as the centroid of each polygon of the
mesh.
• Finally, each vertex in the new mesh is formed as the average
of
– a vertex in the old mesh,
– a face point for a polygon that touches that old vertex, and
– the edge points for the two edges that belong to that polygon
and touch that old vertex.
Doo-Sabin Subdivision

The new mesh, therefore, will


• create quadrilaterals for each edge in the old mesh,
• create a smaller n-sided polygon for each n-sided polygon in the old mesh, and
• create an n-sided polygon for each n-valence vertex (Valence being the
number of edges that touch the vertex).
Catmull-Clark Subdivision

• A face with n edges are subdivided into n quadrilaterals

• Quads are better than triangles at capturing the symmetries


of natural and man-made objects. Tube like surfaces (arms,
legs, fingers) are easier to model.
Catmull-Clark Subdivision

FACE

1 n
f = ∑ vi
n 1
EDGE

v1 + v2 + f1 + f 2
e=
4
VERTEX

n−2 1 1
vi +1 = vi + 2 ∑j e j + n 2 ∑f j
n n j
Modelling with Catmull-Clark

• Subdivision produces smooth continuous surfaces.


• How can “sharpness” and creases be controlled in a
modeling environment?
ANSWER: Define new subdivision rules for “creased”
edges and vertices.

1. Tag Edges sharp edges.


2. If an edge is sharp, apply new sharp
subdivision rules.
3. Otherwise subdivide with normal
rules.
Sharp Edges…

• Tag Edges as “sharp” or “not-sharp”


• n = 0 – “not sharp”
• n > 0 – sharp
During Subdivision,
• if an edge is “sharp”, use sharp subdivision rules.
Newly created edges, are assigned a sharpness of
n-1.
• If an edge is “not-sharp”, use normal smooth
subdivision rules.

IDEA: Edges with a sharpness of “n” do not get


subdivided smoothly for “n” iterations of the
algorithm.

•In the picture on the right, the control mesh is


a unit cube
•Different sharpness applied
Sharp Rules

FACE (unchanged)

1 n
f = ∑ vi
n 1
EDGE

v1 + v2
e=
2
VERTEX
# adj. Sharp edges

corner >2
vi +1 = vi
crease 2 e1 + 6vi + e2
vi +1 =
8
Another example of creases
Non-Integer Sharpness

• Density of newly generated mesh increases rapidly.

• In practice, 2 or 3 iterations of subdivision is sufficient.

• Need better “control”.

IDEA: Interpolate between smooth and sharp rules for non-


integer sharpness values of n.
Subdivision Surfaces in character animation
[DeRose98]

• Used for first time in


Geri’s game to overcome
topological restriction of
NURBS
• Modelled Geri’s head,
hands, jacket, trousers,
shirt, tie, and shoes
• Developed cloth
simulation methods
Demo movie [Geri’s Game]

• Academy Award winning movie by Pixar

Demo of Catmull-Clark subdivision surface


• http://www.youtube.com/watch?
v=lU8f0hnorU8&feature=related
Adaptive Subdivision

• Not all regions of a model


need to be subdivided.

• Idea: Use some criteria and


adaptively subdivide mesh
where needed.
– Curvature
– Screen size ( make triangles
< size of pixel )
– View dependence
• Distance from viewer
• Silhouettes crack
• In view frustum
subdivide
– Careful! Must ensure that
“cracks” aren’t made
View-dependent refinement of progressive meshes
Hugues Hoppe.
(SIGGRAPH ’97)
Subdivision Surface Summary

• Advantages
– Simple method for describing complex surfaces
– Relatively easy to implement
– Arbitrary topology
– Local support
– Guaranteed continuity
– Multi-resolution

• Difficulties
– Intuitive specification
– Parameterization
– Intersections
References

• A very good website for parametric curves / surfaces http://


www.cs.mtu.edu/~shene/COURSES/cs3621/
• DeRose, Tony, Michael Kass, and Tien Truong. Subdivision Surfaces in Character
Animation. SIGGRAPH 98.
• Clark, E., and J. Clark. Recursively generated B-spline surfaces on arbitrary
topological meshes. Computer Aided Geometric Design, Vol. 10, No. 6, 1978.
• Doo, D. and M. Sabin. Behavior of Recursive Division Surfaces Near
Extraordinary Points. Computer-Aided Design. Vol. 10, No. 6, 1978.
Links

• http://www.ibiblio.org/e-notes/Splines/basis.html

• http://i33www.ira.uka.de/applets/mocca/html/noplugin/BSplineBasis/
AppBSplineBasis/index.html

• http://geom.ibds.kit.edu/applets/mocca/html/noplugin/IntBSpline/
AppInsertion/index.html

• http://www.multires.caltech.edu/teaching/demos/java/chaikin.htm

• http://i33www.ira.uka.de/applets/mocca/html/noplugin/curves.html

• http://www.rose-hulman.edu/~finn/CCLI/Applets/DooSabinApplet.html

You might also like