Subdivision Curves & Surfaces

advertisement
Subdivision Curves & Surfaces
and Fractal Mountains.
CS184 – Spring 2011
Outline
• Review Bézier Curves
• Subdivision Curves
• Subdivision Surfaces
– Quad mesh (Catmull-Clark scheme)
– Triangle mesh (Loop scheme)
• Fractal Mountains
V2
Review of Bézier Curves
DeCastlejau Algorithm
V3
V1
Insert at t = ¾
V4
001
Review of Bézier Curves
DeCastlejau Algorithm
011
Ignore funny notation at vertices!
(= CS 284 stuff )
000
Insert at t = ¾
111
001
Review of Bézier Curves
DeCastlejau Algorithm
0¾1
011
00¾
¾11
000
Insert at t = ¾
111
001
Review of Bézier Curves
DeCastlejau Algorithm
0¾1
011
0¾¾
00¾
¾¾1
¾11
000
Insert at t = ¾
111
001
Review of Bézier Curves
DeCastlejau Algorithm
0¾1
011
0¾¾
00¾
¾¾¾
¾¾1
¾11
000
Insert at t = ¾
111
001
Review of Bézier Curves
DeCastlejau Algorithm
0¾1
011
0¾¾
00¾
¾¾¾
¾¾1
¾11
Curve position and
tangent for t = ¾
000
Insert at t = ¾
111
Subdivision of Bézier Curves
001
0¾1
011
0¾¾
00¾
¾¾¾
¾¾1
¾11
This also yields all control points for
subdivision into 2 Bezier curves
000
Insert at t = ¾
111
Subdivision of Bézier Curves
001
0¾1
011
0¾¾
00¾
¾¾¾
¾¾1
¾11
Convex Hull Property!
000
Insert at t = ¾
111
Bézier Curves Summary
• DeCastlejau algorithm is good for
– Evaluating position(t) and tangent(t),
– Subdividing the curve into 2 subcurves
with their own control polygons.
• Subdivision of Bézier curves and
their convex hull property allows for:
– Adaptive rendering based on a flatness criterion,
– Adaptive collision detection using line segment tests.
Outline
• Review Bézier Curves
• Subdivision Curves
• Subdivision Surfaces
– Quad mesh (Catmull-Clark scheme)
– Triangle mesh (Loop scheme)
• Fractal Mountains
Subdivision Curves
V20
V30
An approximating scheme
Limit curve
V10
• Subdivision is a recursive 2 step process
– Topological split
– Local averaging / smoothing
V40
Subdivision Curves
V2
0
E20
E10
V10
V30
E30
E40
• Subdivision is a repeated 2 step process
– Topological split
– Local averaging / smoothing
V40
Subdivision Curves
V2
E21
0
V21
V30
V31
E11
E31
V11
V10
E41
• Subdivision is a repeated 2 step process
– Topological split
– Local averaging / smoothing
V41
V40
Subdivision Curves
V2
E21
0
V21
V30
V31
E11
E31
V11
V10
E41
• Subdivision is a repeated 2 step process
– Topological split
– Local averaging / smoothing
V41
V40
Subdivision Curves
V2
E21
0
V21
V30
V31
E11
E31
V11
V10
E41
• Subdivision is a repeated 2 step process
– Topological split
– Local averaging / smoothing
V41
V40
Results in a B-spline Curve
Knots:
4
1
2
3
4
1
2
3
4
Subdivision Curve Summary
• Subdivsion is a recursive 2 step process:
– Topological split at midpoints,
– Local averaging/smoothing operator applied.
• Doubles the number of vertices at each step
• Subdivision curves are nothing new:
– Suitable averaging rules can yield
uniform B-spline curves.
Outline
• Review Bézier Curves
• Subdivision Curves
• Subdivision Surfaces
– Quad mesh (Catmull-Clark scheme)
– Triangle mesh (Loop scheme)
• Fractal Mountains
Subdivision Overview
Control Mesh
Topological Split
Averaging
Limit Surface
• Subdivision is a two part process:
– Topological split
– Local averaging / smoothing
Subdivision Overview
Control Mesh
Generation 1
Generation 2
Generation 3
• Repeated uniform subdivisions of the control mesh
converge to the limit surface.
• Limit surface can be calculated in closed form for
stationary schemes (averaging mask does not change).
Outline
• Review Bézier Curves
• Subdivision Curves
• Subdivision Surfaces:
– Quad mesh (Catmull-Clark scheme)
– Triangle mesh (Loop scheme)
• Fractal Mountains
B-spline Surfaces
• A cubic B-spline surface patch is controlled by
a regular 4x4 grid of control points
B-spline Surfaces
• 2 adjacent patches share 12 control points
and meet with C2 continuity
B-spline Surfaces
• Requires a regular rectangular control mesh grid
and all valence-4 vertices to guarantee continuity.
Catmull-Clark Subdivision Surface
• Yields smooth surfaces over
arbitrary topology control meshes.
• Closed control mesh  closed limit
surface.
• Quad mesh generalization of B-splines
– C1 at non-valence-4 vertices,
– C2 everywhere else (B-splines).
• Also: Sharp corners can be tagged
– Allows for smooth and sharp features,
– Allows for non-closed meshes.
Catmull-Clark Subdivision
Gen 0
Gen 1
Gen 2
• Extraordinary vertices are generated by
non-valence-4 vertices and faces in the input mesh.
• No additional extraordinary vertices are created
after the first generation of subdivision.
Catmull-Clark Averaging
C20
V20
C30
V3 0
F2 0
F3
V4
C10
0
E20
E30
E40 V00
F1 0
E10
0
F4 0
V10
En0
Fn 0
C40
Vn0
Cn
g
g
V

V
i
E ig  0
2
g
g
g
g
V

V

C

V
i
i
i 1
Fig  0
4
(simple averaging)
0
1 n g 1 n g
(n - 3)V  2  E i   Fi
n i 1
n i 1
g 1
V0 
n
g
0
n = valence
Outline
• Review Bézier Curves
• Subdivision Curves
• Subdivision Surfaces
– Quad mesh (Catmull-Clark scheme)
– Triangle mesh (Loop scheme)
• Fractal Mountains
Loop Subdivision Surface
Gen 0
g
g
V

V
i
E ig  0
2
Gen 1
Gen 2
2

3  2 cos( 2 / n) 
a
32
n
1
V0g 1  aV0g  (1  a)  E ig
n i 1
n = valence
Summary
• Subdivision is a 2 step recursive process:
– Topological split,
– Local averaging / smoothing.
• It is an easy way to make smooth objects
– of irregular shape
– of topologies other than rectangular (torus).
Outline
• Review Bézier Curves
• Subdivision Curves
• Subdivision Surfaces
– Quad mesh (Catmull-Clark scheme)
– Triangle mesh (Loop scheme)
• Fractal Mountains
Fractals
• Self-similar recursive modeling operators:
Sierpinski Triangle
Koch Snowflake
Linear Fractal Mountains
Gen 0:
Gen 1:
Gen 2:
Gen 3:
• 2-step recursive process:
– Subdivide chain by creating edge midpoints,
– Randomly perturb midpoint positions
(proportional to subdivided edge length).
Fractal Mountain Surfaces
Gen 0
Gen 1
• 2-step recursive process:
– Subdivide triangles at edge midpoints,
– Randomly perturb midpoint positions.
Gen 2
Fractal Mountains Summary
• 2-step recursive process:
– Topological split at edge midpoints,
– Random perturbation of midpoint positions.
• Triangle topological split maintains a
water-tight connected mesh.
• Useful to make uneven, “natural” terrain.
• Often a low-order subdivision is good
enough to control terrain-following vehicles.
Download