



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Lecture 13 6.837 Fall 2002
Orientation interpolation
Dynamics
Some slides courtesy of Leonard McMillan and Jovan Popovic
Lecture 11 Slide 2 6.837 Fall 2003
Interpolation Splines Articulated bodies Forward kinematics Inverse Kinematics Optimization Gradient descent Following the steepest slope Lagrangian multipliers Turn optimization with constraints into no constraints
Lecture 11 Slide 3 6.837 Fall 2003
Debug all sub-parts as you write them
Print as much information as possible
Use simple test cases
When stuck, use step-by-step debugging
Lecture 11 Slide 4 6.837 Fall 2003
Debug all these steps: Sphere rasterization Ray initialization Marching Object insertion Acceleration
Lecture 11 Slide 5 6.837 Fall 2003
First brainstorming session on Thursday Groups of three
Proposal due Monday 10/ A couple of pages Goals Progression Appointment with staff
Lecture 11 Slide 6 6.837 Fall 2003
Keyframing automate the inbetweening good control less tedious creating a good animation still requires considerable skill and talent Procedural animation describes the motion algorithmically express animation as a function of small number of parameteres Example: a clock with second, minute and hour hands hands should rotate together express the clock motions in terms of a “seconds” variable the clock is animated by varying the seconds parameter Example 2: A bouncing ball Abs(sin(ωt+θ 0 ))*e -kt
ACM © 1987 “Principles of traditional animationapplied to 3D computer animation”
Lecture 11 Slide 7 6.837 Fall 2003
Physically Based Animation Assign physical properties to objects (masses, forces, inertial properties) Simulate physics by solving equations Realistic but difficult to control
Motion Capture Captures style, subtle nuances and realism You must observe someone do something
ACM© 1988 “Spacetime Constraints”
Lecture 11 Slide 8 6.837 Fall 2003
Overview
Interpolation of rotations, quaternions
Euler angles
Quaternions
Dynamics
Particles
Rigid body
Deformable objects
x ( t) v ( t)
Lecture 11 Slide 9 6.837 Fall 2003
Rotation matrices
Given rotation matrices M (^) i and time ti , find M(t) such that M(ti )=M (^) i.
M =
u v
n
u x
v x
n x
u y
v y
n y
u z
v z
n z
Lecture 11 Slide 10 6.837 Fall 2003
Interpolate each entry independently Example: M 0 is identity and M 1 is 90o^ around x-axis
Is the result a rotation matrix?
1 0 0 1 0 0 1 0 0 Interpolate ( 0 1 0 , 0 0 1 ) 0 0.5 0. 0 0 1 0 1 0 0 0.5 0.
⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎢ ⎥ ⎢ ⎥ (^) =⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢⎣ ⎥⎦ ⎢⎣ − ⎥⎦ ⎢⎣ − ⎥⎦
For example, RR T^ does not equal identity. This interpolation does not preserve rigidity (angles and lengths)
Lecture 11 Slide 11 6.837 Fall 2003
How many degrees of freedom for 3D orientations?
3 degrees of freedom:
e.g. direction of rotation and angle
Or 3 Euler angles
Lecture 11 Slide 12 6.837 Fall 2003
An Euler angle is a rotation about a single axis. Any orientation can be described composing three rotation around each coordinate axis.
Roll, pitch and yaw
http://www.fho-emden.de/~hoffmann/gimbal09082002.pdf
Lecture 11 Slide 19 6.837 Fall 2003
Interpolate orientation on the unit sphere
By analogy: 1-, 2-, 3-DOF rotations as constrained points on 1, 2, 3-spheres
Lecture 11 Slide 20 6.837 Fall 2003
1D sphere and complex plane
Interpolate orientation in 2D 1 angle But messy because modulo 2π Use interpolation in (complex) 2D plane Orientation = complex argument of the number
θ 0
θ 1
Lecture 11 Slide 21 6.837 Fall 2003
l inear int erp olation (lerp) in the plane interpolates the straight line between the two orientations and not their spherical distance. => The interpolated motion does not have uniform velocity: it may speed up too much:
( )
( ) ( )
0 1 0 1
1 0 1
sin 1 sin slerp , , ( ) , sin
where cos
t t t t
q q q q q
q q
ω ω ω
ω −
q 0 q 1
q (^) ( t ) q ( t)
keyframes lerp slerp Solution: S pherical l inear int erp olation (slerp): interpolate along the arc lines by adding a sine term.
lerp ( q 0 (^) , q 1 (^) , t ) = q ( ) t = q 0 (^) ( 1 − t )+ q 1 t
Lecture 11 Slide 22 6.837 Fall 2003
2-angle orientation
Embed 2-sphere in 3D 2 angles Messy because modulo 2π and pole Use linear interpolation in 3D space Orientation = projection onto the sphere Same velocity correction
Lecture 11 Slide 23 6.837 Fall 2003
Use the same principle interpolate in higher-dimensional space Project back to unit sphere Probably need the 3-sphere embedded in 4D
More complex, harder to visualize Use the so-called Quaternions Due to Hamilton (1843); also Shoemake, Siggraph '
Lecture 11 Slide 24 6.837 Fall 2003
Quaternions
Quaternions are unit vectors on 3-sphere (in 4D) Right-hand rotation of θ radians about v is q = {cos(θ/2); v sin(θ/2)} Often noted (s, v ) What if we use – v? What is the quaternion of Identity rotation? Is there exactly one quaternion per rotation?
What is the inverse q-1^ of quaternion q {a, b, c, d}?
θ
v
Lecture 11 Slide 25 6.837 Fall 2003
Quaternions
Quaternions are unit vectors on 3-sphere (in 4D)
Right-hand rotation of θ radians about v is q = {cos(θ/2); v sin(θ/2)} Often noted (s, v ) Also rotation of –θ around - v
What is the quaternion of Identity rotation? q i = {1; 0; 0; 0} Is there exactly one quaternion per rotation? No, q ={cos(θ/2); v sin(θ/2)} is the same rotation as -q ={cos((θ+2π)/2); v sin((θ+2π)/2)} Antipodal on the quaternion sphere What is the inverse q-1^ of quaternion q {a, b, c, d}? {a, -b, -c, -d}
θ
v
Lecture 11 Slide 26 6.837 Fall 2003
Quaternion Algebra
Two general quaternions are multiplied by a special rule:
Sanity check : {cos(α/2); v sin(α/2)} {cos(β/2); v sin(β/2)}
r r r r r r
Lecture 11 Slide 27 6.837 Fall 2003
Quaternion Algebra
Two general quaternions are multiplied by a special rule:
Sanity check : {cos(α/2); v sin(α/2)} {cos(β/2); v sin(β/2)}
{cos(α/2)cos(β/2) - sin(α/2) v. sin(β/2)} v , cos(β/2) sin(α/2) v + cos(α/2)sin(β/2) v + v × v }
{cos(α/2)cos(β/2) - sin(α/2) sin(β/2), v (cos(β/2) sin(α/2) + cos(α/2) sin(β/2))}
{cos((α+β)/2), v sin((α+β)/2) }
r r r r r r
Lecture 11 Slide 28 6.837 Fall 2003
4D representation of orientation
q = {cos(θ/2); v sin(θ/2)}
Inverse is q -1^ =(s, - v )
Multiplication rule
Consistent with rotation composition
How do we apply rotations? How do we interpolate?
r r r r r r
θ
v
Lecture 11 Slide 29 6.837 Fall 2003
Quaternion Algebra
Two general quaternions are multiplied by a special rule:
To rotate 3D point/vector p by q , compute q {0; p } q - p= (x,y,z) q ={ cos(θ/2), 0,0,sin(θ/2) } = {c, 0,0,s} q {0, p }= {c, 0, 0, s} {0, x, y, z}
r r r r r r
= {c.0- zs, c p +0(0,0,s)+ (0,0,s) × p } = {-zs, c p + (-sy,sx,0) }
q {0, p } q -1^ = {-zs, c p + (-sy,sx,0) } {c, 0,0,-s} = {-zsc-(c p +(-sy,sx,0)).(0,0,-s), -zs(0,0,-s)+c(c p +(-sy, sx,0))+ (c p + (-sy,sx,0) ) x (0,0,-s) } = {0, (0,0,zs^2 )+c^2 p +(-csy, csx,0)+(-csy, csx, 0)+(s^2 x, s^2 y, 0)} = {0, (c^2 x-2csy-s 2 x, c^2 y+2csx-s^2 y, zs2+sc^2 )} = {0, x cos(θ)-y sin(θ), x sin(θ)+y cos(θ), z } Lecture 11 Slide 30 6.837 Fall 2003
Quaternion Algebra
Two general quaternions are multiplied by a special rule:
To rotate 3D point/vector p by q , compute q {0; p } q -
Quaternions are associative: ( q 1 q 2) q 3 = q 1 ( q 2 q 3) But not commutative: q 1 q 2 ≠ q 2 q 1
r r r r r r
Lecture 11 Slide 37 6.837 Fall 2003
Fun:Julia Sets in Quaternion space
Julia set Zn+1 =Zn^2 +C
Do the same with Quaternions! Rendered by Skal (Pascal Massimino) http://skal.planet-d.net/
This is 4D, so we need the time dimension as well
Lecture 11 Slide 38 6.837 Fall 2003
3 angles represented in 4D q = {cos(θ/2); v sin(θ/2)}
Weird multiplication rules
Good interpolation using slerp
θ
v
r r r r r r
q ( t)
slerp
Lecture 11 Slide 39 6.837 Fall 2003
Overview
Interpolation of rotations, quaternions
Euler angles
Quaternions
Dynamics
Particles
Rigid body
Deformable objects
x ( t ) v ( t)
Lecture 11 Slide 40 6.837 Fall 2003