modeling modeling is simply the process of creating 3d objects –many different processes to create...
TRANSCRIPT
Modeling
• Modeling is simply the process of creating 3D objects– Many different processes to create models– Many different representations of model data
• Once the models are obtained, one can transform them to the correct locations in space, place a virtual camera in space, and render a 2D image of the scene
1 Polygonal
• Complex objects arebroken down intomany simple polygons
• Polygons form the “skin” of the object– Objects are hollow– Polygons have a front face and a back face
Triangulation
• How are triangles obtained?– Triangulating a set of surface points
• Several different triangulation approaches – Delaunay triangulations attempt to equalize
triangle angles (reduces long skinny triangles)
How Many Triangles?
• More triangles are needed in surface areas that require more geometric detail– Higher curvature more triangles necessary
Level Of Detail (LOD)
• It can be very costly to always display an entire object at the greatest level of detail
• Less detail is necessary the farther away you are from on object– Also depends on the viewing angle and screen size
• Solution: create several models of the object at different levels of detail– Display the correct one for the viewing distance
LOD
50 Vertices 500 Vertices 2000 Vertices
LOD
• How to create the same model in multiple levels of detail?– Ex: start with most detailed, resample with less
vertices, and then re-triangulate
• When to switch models when rendering?– Based on distance and screen size
– Ex: 640x480 screen 307,200 pixels Object takes up half of screen 150K
pixels Any more than 300K triangles (half are
facing away from the camera) is overkill at this distance and screen size
– Visual artifacts can occur at switching point
Creating the Surface Points
• Triangulation works on a set of points– One needs to create this surface point set
• Many different approaches:– Manual placement– Mathematical (geometrical) generation– Scanning real objects
Mathematical Generation
• Solids of Revolution– Rotation of a cross-section around an axis
• Spheres• Cones• Cylinders
Mathematical Generation
• Extrusion– Extrude a cross-section along a profile curve– Scale may vary along the profile
• Many metal and plastic parts• Cones• Cylinders• Bottles
Scanning Real Objects
• Laser scanning
• Tomographic methods– Medical scanning (Xray, CT, MRI)– Radar
Recovered 3D model
Hand-held laser
scanner
Slice of brain from CT scan
Recovered 3D model of lungs
Triangle Representations
• Graphics cards do most of the triangle work– Need an efficient way to send triangles to the card
• Some typical primitive triangle representations:– Lists– Fans– Strips
1.6 vertices per triangle
1.5 vertices per triangle
3.0 vertices per triangle
Constructive Solid Geometry
• Unlike polygonal approaches, CSG models are “solids”– Polygonal models are “skins”
• Solid approaches are often better suited for medical applications because– Cutting slices through objects– Representing internal functional data
CSG Trees
• CSG models are stored in trees– Leaves are primitive shapes
• Spheres, Cubes, Cones, etc.
– Nodes are Boolean operations• Union, Difference, Intersection
CSG Operations
• Primitives:
• Union:
• Intersection:
• Difference:
CSG Rendering
• CSG models can be rendered by:– Computing surface points and triangulating
• Rendering can then be performed by standard hardware
– Use of special CSG rendering routines• Not hardware optimized
Representing Curves
There are many different methods of representing general curves (rather than attempt to model all surfaces as some existing function, say a Sine or Cosine). The most common are:
– Cubic Splines– Bezier Curves– B-splines– NURBS and -splines
• Find a simple formula that follows the trend of given discrete data points
• Allows positions in between data points to be calculated and drawn
• Satisfies a pre-specified amount of smoothness
Curve Fitting
Two approaches• Interpolation – fit the discrete data points
exactly• Approximation – follow the trend of the data
points closely, but satisfy other criteria, e.g. – satisfy a pre-specified amount of smoothness
Curve Fitting
General approach• build the curve fitting function from a
restricted class of easily computed functions– Usually polynomials of low degree– Sine and cosine functions are common in
theoretical curve fitting applications (e.g. smoothing of data), but in practice these may be computationally too expensive.
Curve Fitting
Curve Fitting
Parametric representation, parameter t
• Case of 2 control points P0 , P1 ,
1100 PtbPtbtQ )()()(
– P0 , P1 , may be points in 2D, or in 3D
– bi(t) are basis functions – fixed.
– bi(t) “blend” points P0 , P1
Linear Interpolation
Case of 2 control points P0 , P1 ,
• parameter t– b0(t)=1-t, b1(t)=t are the basis functions.
– Polynomial of degree 1
– b0(t) + b1(t)= (1-t) + t = 1 for all t
101 PtPttQ )()(
•Q(t) : straight line join between P0 and P1
Curve Fitting
Parametric representation, parameter t
33221100 PtbPtbPtbPtbtQ )()()()()(
– P0 , P1 , P2 , P3 may be points in 2D, or in 3D
– bi(t) are basis functions – fixed.
– bi(t) “blend” points P0 , P1 , P2 , P3
Curve Fitting
• Case of 4 control points P0 , P1 , P2 , P3 ,
As t varies (e.g. between 0 and 1), Q(t) assumes different point values • a weighted combination of P0 , P1 , P2 , P3
• weights vary, via bi(t), with t
33221100 PtbPtbPtbPtbtQ )()()()()(
Curve Fitting
• Weights bi(t) are commonly chosen to be cubic polynomials in t– Polynomial evaluation requires only arithmetic
operations (+,-,*)
33221100 PtbPtbPtbPtbtQ )()()()()(
33
2210
330
22010000
tatataatb
tatataatb
iiiii
)(
...
)(
Curve Fitting
• A cubic polynomial has 4 coefficients, and can be determined from the data of 4 points.– The cubic is the lowest degree polynomial that can
accommodate a non-planar path– (3 points define a plane, so need the 4th out of plane
point)
33
2210
330
22010000
tatataatb
tatataatb
iiiii
)(
...
)(
Interpolation vs. Approximation
• Given a set of n points, to create a curve we either
– interpolate the points (curve passes through all points)
– approximate the points (points describe convex hull of curve)
• Points on curve = knot points
• Points on convex hull (off curve) = control points
Interpolate Approximate
Control points
Convex hull
knot points
• If we have more than 4 points we require a polynomial of higher degree– higher degree polynomials are more difficult to
control– they exhibit unwanted wiggles (oscillations)
Quadratic Cubic Quartic Quintic
Splines
• In general we use cubic polynomials for curves in CG:– minimal wiggles and faster to compute than high
degree polynomials– lowest degree which allows non-planar curves
(quadratics require 3 points, 3 points always lie in the same plane)
Splines
Defining the Cubic Spline• Normally we supply 4 points we wish the spline to
pass through.• If we have more than 4 points we must employ more
than 1 spline use a piecewise cubic polynomial– for n points, we have n individual cubic segments
– without further constraints these will not join smoothly
smoothnon-smooth
Piecewise Polynomial Curves
• Idea:– Use different polynomial functions
for different parts of the curve
• Advantage:– Flexibility– Local control
• Issue:– Smoothness at “joints” (continuity)
Continuity
• Continuity Ck indicates adjacent curves have the same kth derivative at their joints
C0 Continuity
• Adjacent curves share …– Same endpoints: Qi(1) = Qi+1(0)
• Aside: discontinuous curves sometimes called “C-1”
C1 Continuity
• Adjacent curves share …– Same endpoints: Qi(1) = Qi+1(0)
– Same derivatives: Qi ’(1) = Qi+1 ’(0)
C2 Continuity
• Adjacent curves share …– Same endpoints: Qi(1) = Qi+1(0)
– Same derivatives: Qi ’(1) = Qi+1 ’(0)
– Same second derivatives: Qi ’’(1) = Qi+1 ’’(0)
Examples of Continuity
Parametric Curves and Patches
• We will start be examining curves– Bézier curves– B-Spline curves
• Then we will expand to surface patches– Bézier patches– B-Spline patches
Curve Fitting
• The row matrix of polynomials can be written as
33323130
23222120
13121110
0302010032
3210
1
aaaa
aaaa
aaaa
aaaattt
tbtbtbtb
],,,[
)(),(),(),(
Curve Fitting
• and for Q(t), write
3
2
1
03210
P
P
P
Pbbbb ],,,[
33221100 PtbPtbPtbPtbtQ )()()()()(
Curve Fitting
• Substitute:
3
2
1
0
33323130
23222120
13121110
0302010032 1
P
P
P
P
aaaa
aaaa
aaaa
aaaattt ],,,[
33221100 PtbPtbPtbPtbtQ )()()()()(
Bézier Curves
• Pierre Bézier, a French designer, first used them in the 1960’s in the design of Renault car bodies. Same time de Casteljau (Citroen)
• Since, they have been heavily used by Adobe in their fonts as well as in graphic applications
• A Bézier curve is a parametric curve– The function C(u) defines the curve points (x, y, z)
as the parameter u varies through [0..1]
Bézier Cubics
P1 P2
P3P0
Bézier Cubics
For Bézier cubic curves,
the coefficients aij are chosen for 4 properties• Q(0)=P0
• Q(1)=P3
• Q’(0) is in the direction of P1 – P0
• Q’(1) is in the direction of P3 – P2
33221100 PtbPtbPtbPtbtQ )()()()()(
Bézier Cubics
33221100 PtbPtbPtbPtbtQ )()()()()(
)(tb0
)(tb1
)(tb2
)(tb3
Example
P0
P1
P3
P2
Bézier Cubics
33221100 PtbPtbPtbPtbtQ )()()()()(
)(tb0
)(tb1
)(tb2
)(tb3
Example
P0
P1
P3
P2
Bézier Cubics
33221100 PtbPtbPtbPtbtQ )()()()()(
)(tb0
)(tb1
)(tb2
)(tb3
Example
P1 –P0
P2 –P3P0
P1
P3
P2
Bézier Curves
• The blending functions make much more sense graphically
Bézier Curves
• Due to the setup of the blending functions:– The curve goes through the end points
• control points P0 and P3
– The curve doesn’t go through the interior control points
• The interior control influence the curve– The curve is pulled in the direction of the
control point– Moving a control point changes the shape of
the entire curve (called global control)
Bézier - coefficients
3
2
1
032
133 1
03 63
00 3 3
00 0 1 1
P
P
P
Pttt ],,,[
33221100 PtbPtbPtbPtbtQ )()()()()(
The 4x4 matrix coefficients are chosen to satisfy the above 4 properties:
Bézier – Properties check
at t=0:
0
3
2
1
0
3
2
1
0
0001
133 1
03 63
00 3 3
00 0 1 0001
P
P
P
P
P
P
P
P
P
],,,[],,,[
33221100 00000 PbPbPbPbQ )()()()()(
So, (property 1)00 PQ )(
Bézier – Properties check
at t=1:
3
3
2
1
0
3
2
1
0
1000
133 1
03 63
00 3 3
00 0 1 1 1 1 1
P
P
P
P
P
P
P
P
P
],,,[],,,[
33221100 11111 PbPbPbPbQ )()()()()(
So, (property 2)31 PQ )(
[ ] [ ]232 32101 tttttdtd ,,, =,,,
Note: Differentiation of the powers of t gives:
€
′ Q (t) = ddt Q(t)
′ b i(t) = ddt bi(t)
Bézier – Properties check
3
2
1
02
133 1
03 63
00 3 3
00 0 1 321 0
P
P
P
Ptt ],,,[
33221100 PtbPtbPtbPtbtQ )()()()()( ′′′′′
where
first derivative (gradient, velocity) at t:
€
′ Q (t) = ddt Q(t)
′ b i(t) = ddt bi(t)
Bézier – Properties check
)(
],,,[],,,[
10
3
2
1
0
3
2
1
0
3
00 33
133 1
03 63
00 3 3
00 0 1 00 1 0
PP
P
P
P
P
P
P
P
P
33221100 00000 PbPbPbPbQ )()()()()( ′′′′′
So is in the direction of (property 3))(0Q′
first derivative (gradient, velocity) at t=0:
10 to PP
Bézier – Properties check
)(
],,,[],,,[
32
3
2
1
0
3
2
1
0
3
33-00
133 1
03 63
00 3 3
00 0 1 32 1 0
PP
P
P
P
P
P
P
P
P
33221100 11111 PbPbPbPbQ )()()()()( ′′′′′
)(1Q′32 to PP
first derivative (gradient, velocity) at t=1:
So is in the direction of (property 4)
Piecewise continuity
Piecewise Bézier curves can be constructed to have C1 continuity, by ensuring
• the last two control points (2,3) of one segment
• first two control points (3,4) of next segment
are in line.
Bézier Curves
• A Bézier Curve can only “curve” as much as its degree allows– Degree 1 (linear) is a line
– Degree 2 (quadratic) can curve once
– Degree 3 (cubic) can curve twice
• The number of control points is always 1 larger than the degree
Bézier Curves
• So what if you want a really “curvy” curve?– You could increase the degree of the curve
• The downfall of this approach is that each control point has global control over the curve shape
– That is, changing a single control point will modify the shape of the entire curve (not great for modeling)
– High degree curves are “unstable”
• It is computationally expensive
– You could join multiple cubic curves together• Each control point only has influence over its piece of the
curve (local control w.r.t. the entire joined curve)• Hardware can be optimized for cubic curves• But, we must maintain continuity across the joins!
Bézier Curves
• So how are we going to maintain continuity?• Notice that the line between the first 2 control
points specify the tangent of the curve at t=0• And the line between the last 2 control points
specify the tangent of the curve at t=1
Bézier Curves
• So if we line up P2P3 with Q0Q1, then we have the same tangent at end t=1 point of curve P and t=0 point of curve Q
Bézier Curves
• Continuity put into more formal terms:– C0 continuity means the curve points vary smoothly
• That is, the curve is a set of connected points• For our joined example, it means the two joined segments
share the same endpoints– P3 is the same point as Q0
– C1 continuity means the curve’s first derivatives vary smoothly (plus C0 continuity)
• For our joined example, it means the tangents at the end endpoints must be the same (P2, P3, Q0, Q1 must form a line)
– And P0, P1 must form a line with the curve before it and Q2, Q3 must form a line with the curve after it all 4 control points are constrained to some extent
Bézier Curves
– C2 continuity means the curve’s second derivatives vary smoothly (plus C1 continuity)
• Second derivative corresponds to curvature• For our joined example, it implies constrains on
P1, P2, P3, Q0, Q1, and Q2– Plus P0, P1, and P2 are constrained from the curve
before it and Q1, Q2, and Q3 are constrained from the curve after it
– Thus, although it can be achieved, there are so many constrains on the positions of the control points that joined cubic Bézier curves are almost never C2 continuous
Bézier Curves
• Do we care about C2 continuity?– Probably not for simple modeling– But if the curve is being used to specify the
path/orientation of a camera:• Not C0 means the camera position jumps• Not C1 means the camera’s orientation jumps• Not C2 means the change in the camera’s
orientation has sudden jumps
11/19/02
Rendering Bezier Curves (1)• Evaluate the curve at a fixed set of parameter
values and join the points with straight lines
• Advantage: Very simple
• Disadvantages:
– Expensive to evaluate the curve at many points
– No easy way of knowing how fine to sample points, and maybe sampling rate must be different along curve
– No easy way to adapt. In particular, it is hard to measure the deviation of a line segment from the exact curve
11/19/02 (
Rendering Bezier Curves (2)
• Recall that a Bezier curve lies entirely within the convex hull of its control vertices
• If the control vertices are nearly collinear, then the convex hull is a good approximation to the curve
• Also, a cubic Bezier curve can be broken into two shorter cubic Bezier curves that exactly cover the original curve
• This suggests a rendering algorithm:– Keep breaking the curve into sub-curves– Stop when the control points of each sub-curve are nearly
collinear– Draw the control polygon - the polygon formed by the
control points
B-Spline Curves
• B-Splines fix two major problems of Béziers:– Global control of control points– Relationship between degree of the curve and the
number of control points
• This is achieved by letting the user specify any number of control points and automatically constructing a set of cubic curves that are C2– This is similar to a set of joined cubic Bézier curves
• Joined cubic Bézier curves can have any number of control points and are still cubic, and each control point only influences its local cubic curve
– But B-Splines are C2 and have no constraints on control point locations as joined cubic Bézier curves
B-Spline Cubics
For B-Spline cubic curves, (basis splines)
the coefficients aij are chosen for 3 properties between adjacent segments
33221100 PtbPtbPtbPtbtQ )()()()()(
join at continuity : )()(
join at continuity : )()(
join at continuity : )( )(
2next
1next
0next
CQQ
CQQ
CQQ
01
01
01
′′′′
′′
: )( and )( tQtQ next
B-Spline Cubics
B-Spline cubic curves achieve C2 continuity by sacrificing the interpolation at the end points.
In fact, with control points
3210 PPPP ,,,
only a segment between is drawnas t varies between 0 and 1, though itsshape is influenced by as well.
21 PP ,
30 PP ,
B-Spline Cubics
Control Points P0, P1, P2, P3
t=0 t=1
B-Spline Cubics
Control Points P0, P1, P2, P3
t=0 t=1
Effect of moving P3
B-Spline Cubics
Control Points P1, P2, P3, P4
t=0
t=1
Effect of adding P4
B-Spline Cubics
Control Points P0, P1, P2, P3, P4
The curve has C2 continuity at the join point P2
B-Splines - coefficients
3
2
1
032
1331
0363
0303
01411
61
P
P
P
Pttt
],,,[
33221100 PtbPtbPtbPtbtQ )()()()()(
The 4x4 matrix coefficients are chosen to satisfy the above 3 properties:
B-Splines – Properties check
6
4
0141
1331
0363
0303
01410001
0
6
4
1410
1331
0363
0303
01411111
321
4
3
2
161
3
2
1
0
61
321
3
2
1
061
3
2
1
0
61
PPP
P
P
P
P
P
P
P
P
PPP
P
P
P
P
P
P
P
P
],,,[
],,,[
)(Q
],,,[
], , ,[
Q(1)
next
43322110
33221100
00000
11111
PbPbPbPbQ
PbPbPbPbQ
next )()()()()(
) () () () ( )(
So, (property 1) – P1, P2, P3 weighted towards P2
)()( 01 nextQQ
nextQ0C continuity at the join of Q and :
B-Splines - coefficients
tttt
ttttt
dtd
dtd
62001
32101
32
232
2
2
,,, ,,,
,,, ,,,
Note: Differentiation of the powers of t gives:
€
′ Q (t) = ddt Q(t)
′ b i(t) = ddt bi(t)
B-Splines – Properties check
6
33
0303
1331
0363
0303
01410010
0
6
33
3030
1331
0363
0303
01413210
31
4
3
2
161
4
3
2
1
61
31
3
2
1
061
3
2
1
0
61
PP
P
P
P
P
P
P
P
P
PP
P
P
P
P
P
P
P
P
′
′
],,,[
] , , ,[
)(Q
],,,[
], , ,[
(1)Q
next
43322110
33221100
00000
11111
PbPbPbPbQ
PbPbPbPbQ
next )()()()()(
) () () () ( )(
′′′′′
′′′′′
So, (property 2) – slope is in the direction joining P1 to P3
)()( 01 nextQQ ′′
nextQ continuity at the join of Q and :1C
B-Splines – Properties check
6
6126
06126
1331
0363
0303
01410200
0
6
6126
61260
1331
0363
0303
01416200
321
4
3
2
161
4
3
2
1
61
321
3
2
1
061
3
2
1
0
61
PPP
P
P
P
P
P
P
P
P
Q
PPP
P
P
P
P
P
P
P
P
Q
′′
′′
],,,[
] , , ,[
)(
],,,[
], , ,[
(1)
next
43322110
33221100
00000
11111
PbPbPbPbQ
PbPbPbPbQ
next )()()()( )(
) () () () ( )(
′′′′′′′′′′′′′′′′′′′′
So, (property 3) – acceleration is in the direction of (P3 – P2 ) – (P2 – P1 )
)()( 01 nextQQ ′′′′
nextQ continuity at the join of Q and :2C
B-Spline Curves• So just like with Bézier curves, we have control
points (Pi) and blending functions (Bi(u))• However, a full B-Spline curve of M+1 control
points is really made up of M-2 curve segments, each being controlled by 4 of the control points
• Also, the blending functions are defined differently than with Bézier curves, with the two most popular variations being:– Uniform– Non-Uniform
Uniform B-Spline Curves
• Uniform blending functions get their name from the fact that all the blending functions are uniform
Uniform B-Spline Curves
• Recall that each curve segment composing the full B-Spline needs 4 control points modified by 4 blending functions
• This implies that only the section in yellow on the previous slide can be used to define the curve– At either end there are not enough blending functions
• This also implies that the curve will not go through any of the control points, including the first and last (as was the case with Bézier)– There are multiple non-zero blending functions at t=0
and t=1
Rational Curves
• A rational curve is a curve defined in 4D space that is then projected into 3D space
• The main point of using rational curves is that it allows you to define weights on the control points– Giving a control point a higher weight causes the
curve to be pulled more towards that control point
• One can have Rational Bézier curves or Rational B-Spline curves– Or other types of curves not covered (Hermite, etc.)
Parametric Patches
• Parametric patches are used to model smooth curved surfaces and to allow dynamic control over the shape of the surface
• Parametric patches are uses heavily in CAD application and animation
• Currently real-time applications are dominated by triangle meshes– Patches hold many advantages over triangle meshes
and if hardware support for them becomes widespread there could be a major shift to them
Rendering Patches
• To have proper lighting we also need normals for the triangles– We can simply use the triangles normal– Or, if we want to be more accurate, we can
use the actual normal to the parametric surface
• Partial derivative in the u direction is 1st tangent• Partial derivative in the v direction is 2nd tangent• Take their cross product and normalize to produce
the normal vector
Parametric Patches
• One of the first uses of parametric patches is the “Utah Teapot”– The actual teapot is on the left
Polygonal Representation
http://commons.wikimedia.org/wiki/Category:Utah_teapot
Polygonal Representation
http://commons.wikimedia.org/wiki/Category:Utah_teapot
Rendered
Patches
To represent a surface, the concept of “curve” needs to be generalised.
We can construct a sequence of slowly changing curves, each displaced from the previous one in a 3D setting.
Patches
In terms of the present work, we can construct a curve from its control points.
To generate a surface, we place side by side the sequence of curves. Each curve in the sequence will have slightly different control points.
We can arrange the displaced control points themselves to lie on a curve, itself generated from another set of control points!
Bézier Patches
Evaluation: coarse1 patch, 4x4 controls
Bézier Patches
Evaluation: fine1 patch, 4x4 controls
Bézier Patches
Bézier Patches
Bézier Patches
Bézier Patches
Bézier Patches
Bézier Patches
• The following is an example of the control point lattice:
• The surface that is created is based on the control points:
Bézier Patches
Bézier Patches
• The surface is based on Bézier curves• Thus, the surface only matches the control
points at the 4 corners
Bézier Patches
Approach: for a single curve, make the control points Pi variable
– depend on another parameter, u in [0,1], say : Pi (u).
In this way, obtain a new (displaced) curve for each u.
Thus, for u=0, ¼, …1,
)()()()()()()()(),( 00000 33221100 PtbPtbPtbPtbtQ
)()()()()()()()(),( 41
3341
2241
1141
0041 PtbPtbPtbPtbtQ
...
)()()()()()()()(),( 11111 33221100 PtbPtbPtbPtbtQ
Bézier Patches
Generally:
)()()()()()()()(),( uPtbuPtbuPtbuPtbutQ 33221100
Express the variability of itself as a Bézier curve:)(uPi
33221100 iiiii PubPubPubPubuP )()()()()(
by introducing 4 control points for each control point function Pi (u),
3210 iiii PPPP , , ,
Bézier Patches
In total, we need 4x4 control points. We specify the control functions in matrix form:
)(
)(
)(
)(
)(
)(
)(
)(
ub
ub
ub
ub
PPPP
PPPP
PPPP
PPPP
uP
uP
uP
uP
3
2
1
0
33323130
23222120
13121110
03020100
3
2
1
0
Bézier PatchesThus:
)(
)(
)(
)(
)]()()()([
),(
)(
)(
)(
)( )]()()()([
)()()()()()()()(),(
3
2
1
0
33323130
23222120
13121110
030201003210
3
2
1
03210
33221100
ub
ub
ub
ub
PPPP
PPPP
PPPP
PPPPtbtbtbtb
utQ
uP
uP
uP
uPtbtbtbtb
uPtbuPtbuPtbuPtbutQ
Now substitute the matrix expression for P0(u) .. P3(u) :
This has the form:
=
33323130
23222120
13121110
03020100
PPPP
PPPP
PPPP
PPPP
P
))(( ))((=),( ututQ bPbwhere
T
Bézier PatchesBézier Patches
u
An explicit form of is obtained by expressing
in polynomial form:
where B =
)( ),( ut bb
1
-1
-3
3
3
-6
3
3
-3 1
T Bb ] ,[=)( t,tt,t 1 2 3
=)( Bb uT
1
2
3
u
u
Bézier Patches),( utQ
Thus
))(( ))((=),( ututQ bPb T
] ,[= PBt,tt,12 3
u
BT
1
2
3
u
u
Bézier Patches
For reference:
=)(ub BT
Bézier Polynomials
( )
( )
( )333
2322
232
332
u uu
u13u3u- 3uu
u13u3u 6u- 3u u
u1u3u 3u 11
-
- +
- -+ -
= =
Bézier Patches
• Adjusting the control points changes the shape of the surface:
• All the same issue occur with patches as with curves– Control points have global control– Increasing the number of control points
will increase the degree of the patch
Bézier Patches
• Thus, we handle large curvy surfaces the same was as with curves: join patches together
• Recall the continuity constrains:– C0 continuity: edges must match– C1 continuity: colinear control points
• More difficult near joins of 4 patches
Midpoint Subdivision• Repeatedly join midpoints to find new control vertices
– Do it first for each row of original control points: 4x4 -> 4x7
– Then do it for each column of new control points:4x7 -> 7x7
A Potential Problem• One (good) way to subdivide, is:
– If a control mesh is flat enough – draw it– Else, subdivide into 4 sub-patches and recurse on each
• Problem: Neighbouring patches may not be subdivided to the same level– Cracks can appear because join edges have different control meshes– This can be fixed by adding extra edges
Crack
33221100 PtbPtbPtbPtbtQ )()()()()(
Ideally, we want the “weights” of to be
• between 0 and 1
• sum to 1
Then the points will not lie outside the inter-joins of points , that is, be contained in their convex hull.
iP
)(tQiP
Convex Hull property
Convex Hull property
P1 P2
P3P0
Convex Hull property
P1 P2
P3P0
See this as 2D or 3D, as appropriate
3210 PPPP ,,,Convex hull of
Convex Hull property
Holds for Bézier curves
See Bézier Polynomials
Holds for B-Splines
Proved similarly.
Note. From
3
2
1
032
1331
0363
0303
01411
61
P
P
P
Pttt
],,,[
33221100 PtbPtbPtbPtbtQ )()()()()(
we also obtain:
B-Splines – outline sum of weights
B-Splines – outline sum of weights
1
1
1
1
)(+)(+)(+)( tbtbtbtb 3210
=
= = 1
1
1
1
1
0
0
0
1
B-Spline Patches
• B-Spline patches are similar to Bézier patches except that they are based on B-Spline curves
• This implies that:– You can have any number of control points in
either the u or v direction (4x4, 8x12, etc.) and still maintain piecewise C2 cubic patches
– With Uniform patches, the patch is will no go through the control points
Rendering Patches
• There are two types of ways we can render patches:– Render them directly from the parametric
descriptions in hardware• Must have hardware support
– Approximate the patch with a triangle mesh and render this mesh
• Usually done in software• Standard pipeline can be used
Rendering Patches• To approximate the patch with triangles,
we can use a uniform subdivision– Evaluate the surface at fixed (u,v)
intervals and connect the points withtriangle strips
Rendering Patches
• Or we can use an adaptive subdivision• Divide surface in quarters• If approximation patch is “flat enough” relative to the actual surface
patch, then draw it• Otherwise, repeat the sub-division on that quarter
– Pros:• More triangles are generated where the curvature is high,
less triangles where curvature is low
– Cons:• Problems with cracks
– Neighbors not subdividedto the same level
– Can be fixed by addingmore edges
How to Choose a Spline
• Hermite curves are good for single segments where you know the parametric derivative or want easy control of it
• Bezier curves are good for single segments or patches where a user controls the points
• B-splines are good for large continuous curves and surfaces
• NURBS are the most general, and are good when that generality is useful, or when conic sections must be accurately represented (CAD)