Keyframe animation
Oldest keyframe animation
Praxinoscope Zoetrope Phenakistiscope
- 1. Higher than 10 frames per second
- 2. A period of blackness between images
Two conditions to make a moving image in 19th century
Keyframe animation 2. A period of blackness between images - - PowerPoint PPT Presentation
Oldest keyframe animation Two conditions to make a moving image in 19th century 1. Higher than 10 frames per second Keyframe animation 2. A period of blackness between images Phenakistiscope Zoetrope Praxinoscope 2D animation 3D animation
Praxinoscope Zoetrope Phenakistiscope
Two conditions to make a moving image in 19th century
specify the key scenes specify the camera moves and edits specify character gross motion
http://www.pixar.com/featurefilms/abbehind_pop4.html
linear, cubic, parametric curves
constant velocity, ease-in-ease-out, etc
What are the parameters? Position and orientation in 3D Joint angles of the hierarchy Body deformation Facial features Hair Clothing Scene elements such as lights and cameras
Linearly interpolate the parameters between keyframes
x = x0 + t − t0 t1 − t0 (x1 − x0)
end key start key end time start time
t = 0 t = 5 t = 10 t = 15
Qx(t) = axt3 + bxt2 + cxt + dx Qy(t) = ayt3 + byt2 + cyt + dy Qz(t) = azt3 + bzt2 + czt + dz Q(t) = [x(t) y(t) z(t)]
We can use three cubic functions to represent a 3D curve
0 ≤ t ≤ 1
Each function is defined with the range
bold: a vector or a matrix italic: a scalar a · b : inner product a × b : outer product ab : multiplication vectors matrices A · B : AB : multiplication multiplication
C = ax ay az bx by bz cx cy cz dx dy dz T =
t2 t 1
t2 t 1
ax ay az bx by bz cx cy cz dx dy dz = TC d dtQ(t) =
2t 1
˙ Q =
Q(t) = t3 t2 t 1 m11 m12 m13 m14 m21 m22 m23 m24 m31 m32 m33 m34 m41 m42 m43 m44 G1x G1y G1z G2x G2y G2z G3x G3y G3z G4x G4y G4z = T · M · G
How many constraints do we need to determine a cubic curve?
C = M · G
Redefine C as a product of the basis matrix M and the geometry vector G 4
A Hermite curve is determined by
P1 P4
R4 R1 Gh = P1x P1y P1z P4x P4y P4z R1x R1y R1z R4x R4y R4z
Use these elements to construct the geometry vector
Given desired constraints:
Q(0) =
Q(1) =
1 1 1
Q(1) =
2 1
Q(0) =
We can solve for basis matrix Mh
P1 P4 R1 R4 = Gh = 1 1 1 1 1 1 3 2 1 · Mh · Gh Mh = 1 1 1 1 1 1 3 2 1
−1
= 2 −2 1 1 −3 3 −2 −1 1 1
Let’s define B as a product of T and M
Bh(t) =
t2 t 1
2 −2 1 1 −3 3 −2 −1 1 1
Bh(t) indicates the weight of each element in Gh
Q(t) = Bh(t) · P1 P4 R1 R4 t P1 P4 R4 R1 Bh(t)
Indirectly specify tangent vectors by specifying two intermediate points
Gb = P1 P2 P3 P4
R4 = 3(P4 − P3) P3 P4 R4 R1 = 3(P2 − P1) P1 P2 R1
Establish the relation between Hermite and Bezier geometry vectors
Gh = P1 P4 R1 R4 = 1 1 −3 3 −3 3 P1 P2 P3 P4 = Mhb · Gb
Q(t) = T · Mh · Gh = T · Mh · (Mhb · Gb) = T · (Mh · Mhb) · Gb = T · Mb · Gb Mb = MhMhb = −1 3 −3 1 3 −6 3 −3 3 1
http://www.cs.unc.edu/~mantler/research/bezier/index.html
Bb(t) =
t2 t 1
−1 3 −3 1 3 −6 3 −3 3 1
Bezier blending functions are also called Bernstein polynomials
Q(t) = Bb(t) · P1 P2 P3 P4 t Bb(t) P1 P2 P3 P4
What if we want to model a curve that passes through these points? Problem with higher order polynomials: Wiggly curves No local control
Continuity Local control Interpolation
C0: points coincide, velocities don’t C1: points and velocities coincide What’s C2? points, velocities and accelerations coincide
Qv(1) = Qw(0) Q
v(1) = Q w(0)
Q
v(1) = Q w(0)
V3 = W0 V3 − V2 = W1 − W0 V1 − 2V2 + V3 = W0 − 2W1 + W2 W2 = V1 + 4V3 − 4V2
Suppose we want to join two Bezier curves (V0, V1, V2, V3) and (W0, W1, W2, W3) so that C2 continuity is met at the joint
V0 V1 V2 V3 W0 W1 W2 W3
B1 V0 V1 V2 V3 = W0 W0 = V3 W2
What does this derived equation mean geometrically?
W2 = V1 + 4V3 − 4V2 = 2(2V3 − V2) − (2V2 − V1) = 2W1 − B1 W1 W3
What is the relationship between a, b and c, if a = 2b - c?
W2 = V1 + 4V3 − 4V2
What is B2?
W1 = 2V3 − V2
These points are called de Boor points and the frames are called A-frames Instead of specifying the Bezier control points, let’s specify the corners of the frames that forms a B-spline
What is the relationship between Bezier control points and de Boor points? Verify this by yourself
V1 = B1 + 1 3(B2 − B1) V0 = 1 2
3(B1 − B0) + B1 + 1 3(B2 − B1)
3(B2 − B1) V3 = 1 2
3(B2 − B1) + B2 + 1 3(B3 − B2)
Mbs = 1 6 −1 3 −3 1 3 −6 3 −3 3 1 4 1 Q(t) =
t2 t 1
B1 B2 B3 B4
http://www.engin.umd.umich.edu/CIS/course.des/cis577/projects/BSP/welcome.html
Dn = Cn − Cn−1 . . .
C0 C1 C2 C3
D0 = C1 − C0
D0
D1 = 1 2(C2 − C0)
D1
D2 = 1 2(C3 − C1)
D2
Derive Catmull-Rom basis matrix by yourself
Q(t) =
t2 t 1 1 2 −1 3 −3 1 2 −5 4 −1 −1 1 2 P1 P2 P3 P4
C0 C1 C2 C3
C0 C1 C2 C3 D0 D1 D2 D3
Let’s assume we know the first derivative of the spline at these control points If we want to create a Bezier curve between each pair of these points, what are the V’s and W’s control points in terms of C’s and D’s?
V0 = C0 V1 = C0 + 1 3D0 V3 = C1 W0 = C1 W1 = C1 + 1 3D1 W3 = C2 V2 = C1 − 1 3D1 W2 = C2 − 1 3D2 6(V1 − 2V2 + V3) = 6(W0 − 2W1 + W2)
To solve for D’s we apply C2 continuity requirement
D0 + 4D1 + D2 = 3(C2 − C0)
D0 + 4D1 + D2 = 3(C2 − C0) D1 + 4D2 + D3 = 3(C3 − C1) Dm−2 + 4Dm−1 + Dm = 3(Cm − Cm−2) . . .
How many equations do we have? How many variables are we trying to solve?
We can impose more conditions on the spline to solve the two extra degrees of freedom Natural C2 interpolating splines require second derivative to be zero at the endpoints
6(V0 − 2V1 + V2) = 0
Collect m+1 equations into a linear system
2 1 1 4 1 1 4 1 ... 1 4 1 1 2 D0 D1 D2 . . . Dm−1 Dm = 3(C1 − C0) 3(C2 − C0) 3(C3 − C1) . . . 3(Cm − Cm−2) 3(Cm − Cm−1)
Use forward elimination to zero out every thing below the diagonal, then back substitute to compute D’s
Spline types
Continuity Interpolation Local control
B-Splines C2 No Yes Catmull-Rom Splines C1 Yes Yes C2 interpolating splines C2 Yes No
DisplayBezier(V0, V1, V2, V3) begin if (FlatEnough(V0, V1, V2, V3)) Line(V0, V3) else do something
It would be nice if we had an adaptive algorithm that would take into account flatness
V0 V1 V2 V3 V0 V1 V2 V3
V V
1
V
2
V V
1
DisplayBezier(V0, V1, V2, V3) begin if (FlatEnough(V0, V1, V2, V3))
else
V0 V1 V2 V3
Compare total length of control polygon to length of line connecting endpoints:
|V0 − V1| + |V1 − V2| + |V2 − V3| |V0 − V3| < 1 +
Each animation parameter is determined by a 2D curve
Q(u) = (x(u), y(u))
Treat this curve as
θ(u) = y(u) t(u) = x(u)
θ
θ(t)
where is a variable you want to animate. We can think
θ(t)
Apply constraints to make sure that actually is a function
C−1 Cn+1 C0 C1 C2 Cn
t
t s
The problem is that uniform steps in the parameter (u) don’t correspond to uniform path distances We need a relationship between the parameters (u) and the distance traveled
index parametric value arclength
1 2 3 4 0.00 0.05 0.10 0.15 0.20 0.000 0.320 0.080 0.230 0.150
Find the entry in the table closest to this u Or take the u before and after it and interpolate linearly Similarly, we can find u for a given S
t s
Invalid configurations (pass through walls) Unnatural motions (painful twists)