CNM 190 Advanced Digital Animation Lec 10 : Inverse Kinematics & Automating Animation
description
Transcript of CNM 190 Advanced Digital Animation Lec 10 : Inverse Kinematics & Automating Animation
CNM 190CNM 190Advanced Digital AnimationAdvanced Digital Animation
Lec 10 : Inverse Kinematics & Automating Lec 10 : Inverse Kinematics & Automating AnimationAnimation
Dan GarciaDan Garcia, EECS (co-instructor), EECS (co-instructor)
Greg Niemeyer, Art (co-instructor)Greg Niemeyer, Art (co-instructor)
Jeremy HuddlestonJeremy Huddleston, EECS (TA), EECS (TA)
A ski-jumping Luxo, Jr. from A ski-jumping Luxo, Jr. from Spacetime Constraints,Spacetime Constraints, 1988 1988
2/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
OverviewOverview
DanDan Forward vs Forward vs
Inverse Inverse KinematicsKinematics
Automating Automating AnimationAnimation
Short film studyShort film study BoundingBounding Mike’s new carMike’s new car For the BirdsFor the Birds In the RoughIn the Rough
JeremyJeremy Demo of Mel tools Demo of Mel tools
forfor Importing dataImporting data Creating UI elementsCreating UI elements
3/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Background You Know Background You Know AlreadyAlready
3D rigid model3D rigid model Usually given in “da Vinci” Usually given in “da Vinci”
or “relaxed bind” poseor “relaxed bind” pose RiggingRigging
Designing a hierarchical Designing a hierarchical skeletonskeleton
Use fewest joints as Use fewest joints as possible!possible!
BindingBinding Connecting the character’s Connecting the character’s
geometry to its skeletongeometry to its skeleton AnimationAnimation
Moving skeleton moves Moving skeleton moves character due to bindingcharacter due to binding
How to animate?How to animate?
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
4/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Forward vs Inverse Forward vs Inverse KinematicsKinematics
Forward Forward KinematicsKinematics (x,y,z) (x,y,z) Rotate top-level Rotate top-level
joints and the joints and the children joints children joints follow follow automaticallyautomatically
No ambiguityNo ambiguity
Inverse Inverse KinematicsKinematics (x,y,z) (x,y,z) Position the end Position the end
joints and the joints and the inner joints bend inner joints bend to compensateto compensate
Usu lots of Usu lots of solutions!solutions!
(x,y,z)-(x,y,z)-spacespace
--spacespace
FK FK IKIK
5/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
How Does IK Work?How Does IK Work?
You are at point PYou are at point P00 in in N-dim N-dim jointjoint space space
You’re asked to move to You’re asked to move to (x,y,z,…) point P(x,y,z,…) point P11
It’s not clear what values of It’s not clear what values of yield that (x,y,z,…)yield that (x,y,z,…)
How do we get there?How do we get there? Answer: IK SolverAnswer: IK Solver
Any algorithm for doing this Any algorithm for doing this successfullysuccessfully
Must factor in torques, dead Must factor in torques, dead spaces due to constraints, spaces due to constraints, total energytotal energy
PP00
PP11
6/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Let’s Look at a 2D Let’s Look at a 2D Example (1)Example (1)
Two-jointed, robot Two-jointed, robot arm with red targetarm with red target
We can measure how We can measure how close we are at any close we are at any point (from a,b->x,y)point (from a,b->x,y)
If we did this for all If we did this for all a,b angles, we’d get a,b angles, we’d get the graph to the rightthe graph to the right Brightness is distance Brightness is distance
to the red goalto the red goal We only know answer We only know answer
locally -- we search!locally -- we search!
freespace.virgin.net/hugo.elias/models/m_ik2.htm
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture. aa
bb
7/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Let’s Look at a 2D Let’s Look at a 2D Example (2)Example (2)
Two-jointed robot arm with Two-jointed robot arm with red goal targetred goal target
Rotating joint A moves the Rotating joint A moves the tip in tip in aa direction direction This gets us closer to the This gets us closer to the
solution solution Rotating joint B moves the Rotating joint B moves the
tip in tip in bb direction direction Here, this is of no useHere, this is of no use
Most joints can rotate both Most joints can rotate both clockwise and counter-clockwise and counter-clockwiseclockwise After After aa rotates a bit, we rotates a bit, we
need to reverse-rotate need to reverse-rotate b b to to extendextend
We do this entire process We do this entire process incrementally, with small incrementally, with small aa, , bb
freespace.virgin.net/hugo.elias/models/m_ik2.htm
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
8/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Let’s Look at a 2D Let’s Look at a 2D Example (3)Example (3)
Graph below shows error Graph below shows error (distance to target) with (distance to target) with contour equal value linescontour equal value lines
We examine local gradientWe examine local gradient Which direction leads us Which direction leads us
fastest downhill? Go there!fastest downhill? Go there! ““Simple Gradient Simple Gradient
Following”, also known as Following”, also known as “greedy”“greedy”
Do this over and over until Do this over and over until you can’t go anymoreyou can’t go anymore
When you stop, either When you stop, either you’reyou’re There, and you’re done!There, and you’re done! Not there, and you’ve Not there, and you’ve
reachedreached A local minimumA local minimum A constraint-based A constraint-based
minimumminimum
freespace.virgin.net/hugo.elias/models/m_ik2.htm
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
Pose PPose P
9/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
Let’s Look at a 2D Let’s Look at a 2D Example (4)Example (4)
Two ways to calculate Two ways to calculate gradient:gradient: By measurement (move, calc)By measurement (move, calc) By calculation (thanks, By calculation (thanks,
Newton)Newton)
freespace.virgin.net/hugo.elias/models/m_ik2.htm
QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.
for each joint if 3D: axis = axis of rotation for this joint if 2D: axis = (0, 0, 1)ToTip = tip - joint_centreToTarget = target - tipmovement_vector = crossproduct(ToTip, axis) gradient = dotproduct(movement_vector, ToTarget) end loop
10/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Let’s Look at a 3D Let’s Look at a 3D ExampleExample
You don’t need to You don’t need to always specify a always specify a fixed point in space fixed point in space for your end joint.for your end joint.
Alternatively, you Alternatively, you could specify could specify another locus of another locus of points and move to points and move to the closest point on the closest point on the surfacethe surface
freespace.virgin.net/hugo.elias/models/m_ik2.htm
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
QuickTime™ and aTIFF (Uncompressed) decompressor
are needed to see this picture.
11/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
When to use FK vs IK?When to use FK vs IK?
FKFK Can control the Can control the
rotation of a single rotation of a single joint and lock joint and lock othersothers
No unexpected No unexpected elbow/knee flippingelbow/knee flipping
Natural “arcs” by Natural “arcs” by defaultdefault
Works with multi-Works with multi-joints as expectedjoints as expected
IKIK Only need to move Only need to move
a single object to a single object to posepose
Can lock down an Can lock down an end effector (like end effector (like wrist or ankle) while wrist or ankle) while rest of body movesrest of body moves
Good w/2-joint Good w/2-joint chainschains
Great for legs!Great for legs!
12/12Inverse Kinematics & Automating Animationhttp://inst.eecs.berkeley.edu/~selfpace/CNM190
Automating AnimationAutomating Animation Delightful SIGGRAPH Delightful SIGGRAPH
1988 paper entitled: 1988 paper entitled: “Spacetime Constraints”“Spacetime Constraints” Set up a system with real Set up a system with real
physics (torques, gravity)physics (torques, gravity) ……with space AND time as with space AND time as
part of the object’s posepart of the object’s pose Let the system try to Let the system try to
figure out how to optimizefigure out how to optimize Automatic animation!Automatic animation!
Very powerful idea, Very powerful idea, could use it in Olympic could use it in Olympic training simulationtraining simulation