If you can't read please download the document
Upload
morgan-shaw
View
221
Download
0
Embed Size (px)
DESCRIPTION
INTRODUCTION Mostly, we’ve concentrated on objects that are made up of triangles Hardware is set up to render triangles Objects and animation paths can have many different underlying geometric descriptions Example: curves and curved surfaces can be described precisely by equations equations can then be evaluated, and triangles can be created and rendered
Citation preview
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Spring 2015 Dr. Michael J. Reale INTRODUCTION Mostly, weve
concentrated on objects that are made up of triangles Hardware is
set up to render triangles Objects and animation paths can have
many different underlying geometric descriptions Example: curves
and curved surfaces can be described precisely by equations
equations can then beevaluated, and triangles can be created and
rendered ADVANTAGES OF CURVES AnD CURVED SURFACES
1) Compact representation E.g., can define a curve precisely with 4
control points (instead of approximating it with a bunch of lines)
2) Scalable I.e., can turn into 2 polygons or 2000 polygons,
depending on how much detail you want 3) Smoother and more
continuous primitives 4) Animation and collision detection may be
simpler and faster I.e., using underlying mathematical descriptions
rather than checking each polygon with every other polygon Bonus
advantages for real-time rendering: 1) Less memory needed for
representation 2) Fewer points to transform 3) If graphics hardware
DOES handle curved surface descriptions directly, less to transfer
from CPU to GPU OVERVIEW We will touch on the following
subjects:
Parametric Curves Parametric Curved Surfaces Although there are
many kinds of curves/splines/patches out there, we will focus on
Bzier curves andBzier patches PARAMETRIC CURVES INTRODUCTION
Parametric curve = curve that is a function of a parameter t p(t) t
= 0 start of the curve t = 1 end of the curve Increments of t
evenly-spaced distances along curve path great for animations or
camera paths! When dealing with 2D or 3D points, each dimension is
a separate function of t x(t), y(t), z(t) For the slides that
follow, however, we will look at a single function p(t) that
outputs a point (whatever itsdimension) LINEAR INTERPOLATION Linear
interpolation = traces out straight line:
p0 = starting point, p1 = ending point Problem: more than two
points in your path sudden jerks as you jump from one line segment
to thenext (at joints) discontinuous at joints There must be a
better way What we get with linear interpolation What we want
INTRODUCING BEZIER CURVES
Bzier curves (pronounced beh-ze-eh) Basic idea is repeatedly (and
recursively) doing linear interpolation called de Casteljau
algorithm Lets say we have three control points: a, b, and c To get
a point along the curve (say, at t = 1/3) Get d = 1/3 of the way
from a to b Get e = 1/3 of the way from b to c Get f = p(1/3) = 1/3
of the way from d to e In general: BEZIER CURVE DEGREES AND CONTROL
POINTS
The maximum degree of this example is n = 2 (quadratic) The number
of control points is (n+1) = 3 Given a Bezier curve of degree n,
the number of control points is (n+1) BEZIER CURVES: DE CASTELJAU
ALGORITHM
A given point on the curve is defined recursively Control points:
p1 , p2 , p3 , After applying linear interpolation k times
intermediate control points pik are obtained Previous example:
BEZIER CURVES: DEFINITION
A Bezier curve with (n+1) initial control points can be described
recursively: A single point on the curve is defined by: BEZIER
CURVES: PREVIOUS EXAMPLE
So, how does this work?Lets look at our previous example We already
know our initial control points (k = 0): Get the next interpolation
level (k = 1): Final level (k = 2 = n): BEZIER CURVES: ANOTHER
EXAMPLE
Lets say we have a quartic Bezier curve Degree n = 4 Number of
control points (n+1) = 5 We know values of initial control points
Work our way up tree, interpolating as we go BEZIER CURVES USING
BERNSTEIN POLYNOMIALS
Remember how earlier we had turned our quadratic Bezier curve into
a nice tidy algebraic formula? Turns out we can do the same with
EVERY Bezier curve WITHOUT having to do the repeatedinterpolation
use Bernstein form: This form uses Bernstein polynomials (first
term is binomial coefficient): BEZIER CURVES USING BERNSTEIN
POLYNOMIALS
Two properties of Bernstein polynomials: Will stay between 0 and 1
if t is between 0 and 1 All polynomials sum to 1 Means curve will
stay close to control points In fact, a Bezier curve fits within
convex hull of control points: BEZIER CURVES USING BERNSTEIN
POLYNOMIALS
Bernstein polynomials also called blending functions or Bezier
basis functions n = 1 n = 2 n = 3 BEZIER CURVES in MATRIX
FORM
It is comparatively easy to define a Bezier curve with a matrix
Create a matrix that contains the correct Bernstein polynomial
values Create another matrix for the control points Reuse both of
these matrices for each value of t you need Example: a cubic Bezier
curve in matrix form DISADVANTAGES OF BEZIER CURVES
Do not pass through all control points (except endpoints) Degree
increases with number of control points more expensive to evaluate
One solution to the latter problem: piecewise Bezier curves
PIECEWISE BEZIER CURVES
Lets say we have two cubic Bezier curves: q0 , q1 , q2 , q3 r0 , r1
, r2 , r3 We want to join these such that: p(0) = q0 p(1) = q3 = r0
p(3) = r3 How do we do this? PIECEWISE BEZIER CURVES
First of all, we have a t value that can be greater than 1: If t is
[0,1] use first Bezier curve If t > 1 scale and translate value
and use t on second Bezier curve: PIECEWISE BEZIER CURVES: C0
CONTINUITY
To connect the curves, we could just set q3 = r0 HOWEVER, there
could be a sudden change indirection at joint derivative not
continuous This gives us C0 continuity no gaps in position
PIECEWISE BEZIER CURVES: G1 CONTINUITY
Tangent of curve at q0 parallel with (q1 q0 ) Tangent of curve at
q3 parallel with (q3 q2 ) So, make sure (incoming tangent at joint)
= (outgoing tangent at joint): This gives us G1 continuity Says
nothing about the lengths of the tangents Gn = geometric continuity
weaker than corresponding Cn continuity PIECEWISE BEZIER CURVES: C1
CONTINUITY
In previous example, derivatives would be continuous if c = 1.0
implies t2 = 2.0 HOWEVER, we want t2 = 3.0 To get even better
continuity, we can define c as follows: This gives us C1 continuity
derivative is continuous (even at joints) I.e., tangent vectors
point in same direction and are of same length C0 continuity
(position)
G1 continuity (tangent directions) C1 continuity (derivatives)
PARAMETRIC SURFACES INTRODUCTION Parametric surfaces = natural
extension of parametric curves Similar to the jump from lines to
triangles/polygons Often tessellated by evaluating surface at
difference positions and then building triangles for rendering
Patch = surface with rectangular domain Here we will discuss Bezier
patches BEZIER PATCHES Bezier patches = extends Bezier curves
by:
Using two parameters (u,v) Using bilinear interpolation Also lies
in convex hull of control points Start with four points (instead of
two): a, b, c, d Interpolate a & b and c & d to get e and
f: Finally, linearly interpolate between e & f using v: BEZIER
PATCHES More points can be added (i.e., degree can be increased)
Example: biquadratic Bezier surface with 9 control points (n = 2, #
of control points = (n+1)*(n+1) = 3*3) BEZIER PATCHES IN BERNSTEIN
FORM
In Bernstein form, a Bezier patch is defined by: m and n = degree
of the surface Compound degree = m x n BEZIER PATCHES IN BERNSTEIN
FORM: ANOTHER VIEW
If we reinterpret the previous equation We suddenly notice that
qi(v) is a Bezier curve so, basically, weare computing the points
along each Bezier curve with a fixed vvalue, then computing the
value from a Bezier curve made fromTHOSE points BEZIER PATCH:
EXAMPLE Generated quads 4 x 4 control points
Shaded quads Move one control point Most change near control point
PIECEWISE BEZIER PATCHES
Usually you will want to stitch patches together to get a complete
surface However, C0 continuity is going to look terrible Can
enforce C1 continuity by doing the following: Take the two rows
near boundary from each patch: a2j and b1j For each j a2j , b0j ,
and b1j : Must be collinear (i.e., lie on line) Must have same
ratio (with k constant for all j): PIECEWISE BEZIER PATCHES
Problem with previous approach: lose a lot of degrees of freedom
(dont have as much control overpatches) Even worse at corner where
4 patches meet 9 points all in same plane and evenly spaced If you
only want G1 continuity at corners (and only there), can relax to
only make them coplanar PIECEWISE BEZIER PATCHES
C1 continuity required for good-looking texturing G1 continuity
reasonable for reflections and shading, but C1 continuity is better
C0 continuity (position) C1 continuity (derivative)