Computer a jap Animation Algorithms and Techniques Second Edition Rick Parent Ohio State University AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO F ^ k.^ Morgan Kaufmann is an imprint ofelsevier MORGAN KAUFMANN PUBLISHERS
Preface xix Chapter 1 Introductioh 1 1.1 Perception 2 1.2 The Heritage of Animation 4 1.2.1 Early Devices 5 1.2.2 The Early Days of "Conventional" Animation 7 1.2.3 Disney 8 1.2.4 Contributions of Others 10 1.2.5 Other Media for Animation 10 1.2.6 Principles of Animation 11 1.2.7 Principles of Filmmaking 13 1.3 Animation Production 15 1.3.1 Sound 17 1.4 Computer Animation Production 18 1.4.1 Computer Animation Production Tasks 19 1.4.2 Digital Editing 21 1.4.3 Digital Video 24 1.4.4 Digital Audio 25 IX
1.5 A Brief History of Computer Animation 26 1.5.1 Early Activity (pre 1980) 26 1.5.2 The Middle Years (The'80s) 29 1.5.3 Animation Comes ofage (The mid-80's and beyond) 31 1.6 Chapter Summary 35 References 35 Chapter 2 Technical Background 39 2.1 Spaces and Transformations 39 2.1.1 The Display Pipeline 41 2.1.2 Homogeneous Coordinates and the Transformation Matrix 45 2.1.3 Compound Transformation: Concatenating Transformation Matrices 47 2.1.4 Basic Transformations 48 2.1.5 Representing an Arbitrary Orientation 50 2.1.6 Extracting Transformations from a Matrix 54 2.1.7 Description of Transformations in the Display Pipeline 55 2.1.8 Error Considerations 57 2.2 Orientation Representation 61 2.2.1 Fixed Angle Representation 63 2.2.2 Euler Angle Representation 65 2.2.3 Angle and Axis Representation 66 2.2.4 Quaternion Representation 67 2.2.5 Exponential Map Representation 70 2.3 Chapter Summary 70 References 70 Chapter 3 Interpolating Values 73 3.1 Interpolation 73 3.1.1 The Appropriate Function 74 3.1.2 Summary 77 3.2 Controlling the Motion of a Point Along a Curve 78 3.2.1 Computing Are Length 79 3.2.2 Speed Control 95 3.2.3 Ease-in/Ease-out 97
XI 3.2.4 General Distance-Time Functions 105 3.2.5 Curve Fitting to Position-Time Pairs 106 3.3 Interpolation oforientations 109 3.3.1 Interpolating Quaternions 110 3.4 Working with Paths 115 3.4.1 Path Following 115 3.4.2 Orientation along a Path 115 3.4.3 Smoothing a Path 120 3.4.4 Determining a Path along a Surface 126 3.4.5 Path Finding 128 3.4.6 Summary 129 3.5 Chapter Summary 129 References 129 Chapter 4 Interpolation-Based Animation 131 4.1 Key-Frame Systems 132 4.2 Animation Languages 136 4.2.1 Artist-Oriented Animation Languages 137 4.2.2 Füll Featured Programming Languages for Animation 138 4.2.3 Articulation Variables 138 4.2.4 Graphical Languages 139 4.2.5 Actor-Based Animation Languages 140 4.3 Deforming Objects 140 4.3.1 Picking and Pulling 141 4.3.2 Deforming an Embedding Space 143 4.4 Three-dimensional Shape Interpolation 158 4.4.1 Matching Topology 159 4.4.2 Star-Shaped Polyhedra 159 4.4.3 Axial Slices 161 4.4.4 Map to Sphere 163 4.4.5 Recursive Subdivision 168 4.4.6 Summary 170 4.5 Morphing (Two-dimensional) 170 4.5.1 Coordinate Grid Approach 171 4.5.2 Feature-Based Morphing 176 4.6 Chapter Summary 183 References 183
Chapter5 Kinematic Linkages 187 5.1 Hierarchical Modeling 189 5.1.1 Data Structure for Hierarchical Modeling 190 5.1.2 Local Coordinate Frames 197 5.2 Forward Kinematics 198 5.3 Inverse Kinematics 200 5.3.1 Solving a Simple System by Analysis 201 5.3.2 Thejacobian 203 5.3.3 Numeric Solutions to Inverse Kinematics 207 5.3.4 Summary 214 5.4 Chapter Summary 215 References 215 Chapter 6 Motion Capture 217 6.1 Motion Capture Technologies 218 6.2 Processing the Images 219 6.3 Camera Calibration 221 6.4 Three-Dimensional Position Reconstruction 222 6.4.1 Multiple Markers 224 6.4.2 Multiple Cameras 224 6.5 Fitting to the Skeleton 225 6.6 Output from Motion Capture Systems 227 6.7 Manipulating Motion Capture Data 228 6.7.1 Processing the Signals 229 6.7.2 Retargeting the Motion 229 6.7.3 Combining Motions 230 6.8 Chapter Summary 230 References 231 Chapter 7 Physically Based Animation 233 7.1 Basic Physics A Review 234 7.1.1 Simulating a Spring-mass-damper System 237
Xlll 7.2 Spring Meshes 237 7.2.1 Flexible Objects 237 7.2.2 Virtual Springs 241 7.3 Particle Systems 241 7.3.1 Particle Generation 242 7.3.2 Particle Attributes 243 7.3.3 Particle Termination 243 7.3.4 Particle Animation 243 7.3.5 Particle Rendering 244 7.3.6 Particle System Representation 244 7.3.7 Forces on Particles 245 7.3.8 Particle Life Span 245 7.4 Rigid Body Simulation 246 7.4.1 Bodies in Free Fall 247 7.4.2 Bodies in Collision 258 7.4.3 Dynamics of Linked Hierarchies 273 7 ÄÄ Summary 276 7.5 Enforcing Soft and Hard Constraints 276 7.5.1 Energy Minimization 278 7.5.2 Space-Time Constraints 281 7.6 Chapter Summary 283 References 283 Chapter 8 Fluids: Liquids & Gases 287 8.1 Specific Fluid Models 288 8.1.1 Models of Water 288 8.1.2 Models of Clouds (by David Ebert) 300 8.1.3 Models offire 311 8.1.4 Summary 314 8.2 Computational Fluid Dynamics 314 8.2.1 General Approaches to Modeling Fluids 315 8.2.2 CFD Equations 316 8.3 Chapter Summary 321 References 322 Chapter 9 Modeling and Animating Human Figures 325 9.1 Overview of Virtual Human Representation 326 9.1.1 Representing Body Geometry 327
xiv 9.1.2 Geometry Data Acquisition 329 9.1.3 Geometry Deformation 329 9.1.4 Surface Detail 330 9.1.5 Layered Approach to Human Figure Modeling 330 9.2 Reaching and Grasping 333 9.2.1 Modeling the Arm 334 9.2.2 The Shoulder Joint 336 9.2.3 The Hand 337 9.2.4 Coordinated Movement 338 9.2.5 Reaching Around Obstacles 340 9.2.6 Strength 341 9.3 Walking 342 9.3.1 The Mechanics of Locomotion 343 9.3.2 The Kinematics of the Walk 347 9.3.3 Using Dynamics to Help Produce Realistic Motion 351 9.3.4 Forward Dynamic Control 353 9.3.5 Summary 353 9.4 Getting Dressed Up 353 9.4.1 Cloth and Clothing 353 9.4.2 Simple Draping 354 9.4.3 Getting into Clothes 357 9.4.4 Hair 361 9.5 Chapter Summary 363 References 363 Chapter 10 Facial Animation 369 10.1 The Human Face 370 10.1.1 Anatomie Structure 370 10.1.2 The Facial Action Coding System 371 10.2 Facial Models 372 10.2.1 Creating a Continuous Surface Model 375 10.2.2 Textures 380 10.3 Animating the Face 380 10.3.1 Parameterized Models 380 10.3.2 Blend Shapes 382
xv 10.3.3 Muscle Models 382 10.3.4 Expressions 386 10.3.5 Summary 386 10.4 Lip-Sync Animation 386 10.4.1 Articulators of Speech 386 10.4.2 Phonemes 388 10.4.3 Coarticulation 389 10.4.4 Prosody 389 10.5 Chapter Summary 389 References 390 Chapter 11 Modeling Behavior 393 11.1 Knowing the Environment 394 11.1.1 Vision 394 11.1.2 Memory 396 11.2 Aggregate Behavior 396 11.3 Primitive Behaviors 398 11.3.1 Flocking Behavior 398 11.3.2 Prey-Predator Behavior 409 11.4 Modeling Intelligent Behavior 410 11.4.1 Autonomous Behavior 410 11.4.2 Expressions and Gestures 413 11.4.3 Modeling Individuality: Personality and Emotions 414 11.5 Crowd Management 415 11.5.1 Emergent Behavior 415 11.5.2 Statistically Modeled Behavior 416 11.5.3 Internal structure 416 11.6 Chapter Summary 417 References 417 Chapter 12 Special Models for Animation 421 12.1 Implicit Surfaces 421 12.1.1 Basic Implicit Surface Formulation 422 12.1.2 Animation Using Implicitly Defined Objects 423 12.1.3 Collision Detection 425
12.1.4 Deforming the Implicit Surface as a Result of Collision 425 12.1.5 Level Set Methods 428 12.1.6 Summary 429 12.2 Plants 429 12.2.1 A Little Bit of Botany 431 12.2.2 L-Systems 432 12.2.3 Animating Plant Growth 437 12.2.4 Summary 440 12.3 Subdivision Surfaces 441 12.4 Chapter Summary 442 References 443 Appendix A Rendering Issues 445 A. 1 Double Buffering 446 A.2 Compositing 446 A.2.1 Compositing without Pixel Depth Information 449 A.2.2 Compositing with Pixel Depth Information 455 A.3 Displaying Moving Objects: Motion Blur 458 A.4 Drop Shadows 461 A.5 Billboarding and Impostors 466 A.6 Summary 467 References 468 Appendix B Background Information and Techniques 469 B.l Vectors and Matrices 469 B. 1.1 Inverse Matrix and Solving Linear Systems 471 B.1.2 Singular Value Decomposition 479 B.2 Geometrie Computations 480 B.2.1 Components of a Vector 480 B.2.2 Lengthofa Vector 481 B.2.3 Dot Product oftwo Vectors 481 B.2.4 Cross Product of Two Vectors 482 B.2.5 Vector and Matrix Routines 484
B.2.6 Closest Point between Two Lines in Three- Space 487 B.2.7 Area Calculations 488 B.2.8 The Cosine Rule 490 B.2.9 Barycentric Coordinates 490 B.2.10 Computing Bounding Shapes 491 Transformations 507 B.3.1 Transforming a Point Using Vector-Matrix Multiplication 507 B.3.2 Transforming a Vector Using Vector-Matrix Multiplication 507 B.3.3 Axis-Angle Rotations 508 B.3.4 Quaternions 509 Denevit and Hartenberg Representation for Linked Appendages 513 B.4.1 Denavit-Hartenberg Notation 513 B.4.2 A Simple Example 515 B.4.3 Including a Ball-and-Socket Joint 517 B.4.4 Constructing the Frame Description 518 Interpolating and Approximating Curves 519 B.5.1 Equations: Some Basic Terms 519 B.5.2 Simple Linear Interpolation: Geometrie and Algebraic Forms 521 B.5.3 Parameterization by Are Length 522 B.5.4 Computing Derivatives 523 B.5.5 Hermite Interpolation 523 B.5.6 Catmull-Rom Spline 524 B.5.7 Four-Point Form 528 B.5.8 Blended Parabolas 528 B.5.9 Bezier Interpolation/Approximation 530 B.5.10 De Casteljau Construction of Bezier Curves 531 B.5.11 Tension, Continuity, and Bias Control 531 B.5.12 B-Splines 534 B.5.13 Fitting Curves to a Given Set of Points 535 Randomness 537 B.6.1 Noise 537 B.6.2 Turbulence 540 B.6.3 Random Number Generator 540
B.7 Physics Primer 542 B.7.1 Position, Velocity, and Acceleration 542 B.7.2 Circular Motion 543 B.7.3 Newtons Laws of Motion 544 B.7.4 Inertia and Inertial Reference Frames 545 B.7.5 Center of Mass 545 B.7.6 Torque 545 B.7.7 Equilibrium: Balancing Forces 546 B.7.8 Gravity 546 B.7.9 Centripetal Force 547 B.7.10 Contact Forces 547 B.7.11 Centrifugal Force 549 B.7.12 Work and Potential Energy 550 B.7.13 Kinetic Energy 550 B.7.14 Conservation of Energy 550 B.7.15 Conservation ofmomentum 551 B.7.16 Oscillatory Motion 551 B.7.17 Damping 552 B.7.18 Angular Momentum 552 B.7.19 Inertia Tensors 553 B.8 Numerical Integration Techniques 554 B.8.1 Function Integration for Are Length Computation 554 B.8.2 Updating Function Values 556 B.8.3 Updating Position 560 B.9 Standards for Moving Pictures 561 B.9.1 In the Beginning, There Was Analog 561 B.9.2 In the Digital World 565 B.10 Camera Calibration 570 References 575 Index 577