Professional Documents
Culture Documents
CMPT 361
Introduction to Computer Graphics
Torsten Mller
Machiraju/Zhang/Mller
Rendering Pipeline
Hardware
Modelling
Transform
Visibility
Illumination +
Shading
Perception,
Texture/
Color
Interaction
Machiraju/Zhang/Mller
Realism
Reading
Angel Chapter 10
Foley et al. - Chapter 11
Machiraju/Zhang/Mller
Today
Polynomials
Parametric representation
Fairness vs. smoothness
Parametric vs. geometric continuity
Hermite spline
Bezier spline
B-Spline
Surfaces
Subdivision Machiraju/Zhang/Mller
Filling a gap
So far, we have focused on lines, flat
polygons, and simple objects, e.g., spheres
Missing: freeform curves and surfaces
Although smooth curves and surfaces are
converted to polygonal curves and meshes
when rendered, they still provide a good
option for modeling
We follow the text loosely
Machiraju/Zhang/Mller
[Zorin 01]
Horners rule
Consider a cubic polynomial
b(t) = at3 + bt2 + ct + d
Straightforward way to evaluate b(t) takes 6
multiplications and 3 additions
Horners Rule:
b(t) = ((a * t + b) * t + c) * t + d
It takes 3 additions and 3 multiplications. In
general, n +s and n *s for polynomial with
degree = n.
Machiraju/Zhang/Mller
Basis Functions
http://terpconnect.umd.edu/~petersd/interp.html
Machiraju/Zhang/Mller
10
Piece-wise cubic
interpolation
Machiraju/Zhang/Mller
11
Today
Polynomials
Parametric representation
Fairness vs. smoothness
Parametric vs. geometric continuity
Hermite spline
Bezier spline
B-Spline
Surfaces
Subdivision Machiraju/Zhang/Mller
12
13
14
15
16
Continuity of piecewise
polynomials
A single polynomial segment is always C
But we mostly deal with piecewise polynomial
curves
Key: what happens at the joints between segments
C0: curve segments are connected
C1: C0 & 1st-order derivatives agree at joints
C2: C0 & C1 & 2nd-order derivative agree at joints, etc.
17
Geometric continuity
geometric continuity
G0 cont.: curve segments are connected (same as C0)
G1: G0 & 1st-order derivatives are proportional at joints.
Note:
Proportional = same direction but may have different
magnitudes
Weaker than C1
18
On to curve design
We want to design piecewise cubic polynomial curves
that satisfy certain design constraints, e.g.,
Curve should pass through certain points
Curve should have some given derivatives at specific points
Curve should be smooth: G1, C1, C2, or
Curve must be contained in certain area, or has at most this
length, etc.
19
20
x(0) = P1
x(1) = P4
x(0) = R1
x(1) = R4
Machiraju/Zhang/Mller
21
22
Hermite curves
How to interpret this: x(t) = TA = TB1G = HG
G is a vector of observables or control points
H is vector of cubic Hermite bases (blending
polynomials)
For any G, use H to blend four control points to get
curve x(t)
The matrix Mhermite = B1 is really a change of basis
matrix: it changes the monomial basis T into the
Hermite basis H
Hermite curves are completely determined by
Machiraju/Zhang/Mller
Mhermite
23
Machiraju/Zhang/Mller
24
R4
P4 = P1
P4
P1
R4 = kR1
25
Today
Polynomials
Parametric representation
Fairness vs. smoothness
Parametric vs. geometric continuity
Hermite spline
Bezier spline
B-Spline
Surfaces
Subdivision Machiraju/Zhang/Mller
26
27
28
Machiraju/Zhang/Mller
29
30
P1
P3
P0
P5
P4
http://www.cs.princeton.edu/~min/cs426/jar/bezier.html
Machiraju/Zhang/Mller
31
Machiraju/Zhang/Mller
32
Machiraju/Zhang/Mller
33
P4
C1
C3
P5
P6
C4
C5
P7
C2
P3
Machiraju/Zhang/Mller
http://www.cs.technion.ac.il/~cs234325/Applets/applets/bspline/GermanApplet.html
34
35
36
37
[Angel 02]
In matrix form:
http://www.math.psu.edu/dlittle/java/parametricequations/beziersurfaces/index.html
Machiraju/Zhang/Mller
38
39
Collinear
control points
Machiraju/Zhang/Mller
near patch boundary
40
Smoothness of B-spline
surface
C2 continuity is achieved if adjacent patches
share control points
Machiraju/Zhang/Mller
41
Today
Polynomials
Parametric representation
Fairness vs. smoothness
Parametric vs. geometric continuity
Hermite spline
Bezier spline
B-Spline
Surfaces
Subdivision Machiraju/Zhang/Mller
42
deCasteljau Recursion
We can use the convex hull property of
Bezier curves to obtain an efficient
recursive method that does not require any
function evaluations
Uses only the values at the control points
43
44
Machiraju/Zhang/Mller
45
Convex Hulls
{l0, l1, l2, l3} and {r0, r1, r2, r3} each have a convex hull that
that is closer to p(u) than the convex hull of {p0, p1, p2, p3}
This is known as the variation diminishing property.
The polyline from l0 to l3 (= r0) to r3 is an approximation to
p(u). Repeating recursively we get better approximations.
Machiraju/Zhang/Mller
46
Equations
Start with Bezier equations p(u)=uTMBp
l(u) must interpolate p(0) and p(1/2)
l(0) = l0 = p0
l(1) = l3 = p(1/2) = 1/8( p0 +3 p1 +3 p2 + p3 )
Symmetric equations
hold for r(u)
Machiraju/Zhang/Mller
47
Efficient Form
l0 = p0
r3 = p3
l1 = (p0 + p1)
r1 = (p2 + p3)
l2 = (l1 + ( p1 + p2))
r1 = (r2 + ( p1 + p2))
l3 = r0 = (l2 + r1)
Requires only shifts and adds!
Machiraju/Zhang/Mller
48
49
Matrices
Interpolating to Bezier
B-Spline to Bezier
Machiraju/Zhang/Mller
50
Example
These three curves were all generated from
the same original data using Bezier
recursion by converting all control point
data to Bezier control points
Bezier
Interpolating
Machiraju/Zhang/Mller
B Spline
51
Surfaces
Can apply the recursive method to surfaces if we
recall that for a Bezier patch curves of constant u (or
v) are Bezier curves in u (or v)
First subdivide in u
Process creates new points
Some of the original points are discarded
original and discarded
original and
kept
Machiraju/Zhang/Mller
new
52
Second Subdivision
53
Normals
For rendering we need the normals if we
want to shade
Can compute from parametric equations
54
Utah Teapot
Most famous data set in computer graphics
Widely available as a list of 306 3D vertices
and the indices that define 32 Bezier patches
Machiraju/Zhang/Mller
55
Subdivision Schemes
In order to draw a curve we need to find
points on it:
Machiraju/Zhang/Mller
56
Subdivision Schemes
Same for surfaces:
57
Machiraju/Zhang/Mller
58
Loop
Guaranteed to be smooth everywhere except
at extraordinary vertices
Face Split
Triangular
meshes
approximating
Machiraju/Zhang/Mller
59
Loop (2)
Machiraju/Zhang/Mller
60
Loop - Boundary
Subdivision Mask for
Boundary Conditions
Vertex Rule
Edge Rule
Machiraju/Zhang/Mller
61
Modified Butterfly
Face Split
Triangular
meshes
interpolating
Machiraju/Zhang/Mller
62
Catmull-Clark
Face Split
Quad. Meshes
(extents to
arbitrary)
approximating
Masks for odd vertices
Machiraju/Zhang/Mller
63
Catmull-Clark (2)
Face Split
Quad. Meshes
(extents to
arbitrary)
approximating
Masks for even vertices
Machiraju/Zhang/Mller
64
Catmull-Clark (2)
FACE
EDGE
VERTEX
Machiraju/Zhang/Mller
65
Kobbelt
Face Split
Quad. Meshes
interpolating
Machiraju/Zhang/Mller
66
Kobbelt (2)
Mask for face vertex
adjacent to an
extraordinary vertex.
Two steps
The edge vertices
The face vertex
the edge odd control
point adjacent to an
extraordinary vertex
Machiraju/Zhang/Mller
67
Doo-Sabin
Vertex Split
Quad. Meshes
interpolating or approximating??
Machiraju/Zhang/Mller
68
Mid-Edge
Midedge, the simpler version of Doo-Sabin
scheme.
Machiraju/Zhang/Mller
69
Doo-Sabin scheme
Midedge scheme
Machiraju/Zhang/Mller
70
Subdivision Schemes
Butterfly
Loop
CatmullClark
Doo-Sabin
Machiraju/Zhang/Mller
71
72