Computer Animation Algorithms and Techniques Rick Parent Ohio State University z< MORGAN KAUFMANN PUBLISHERS AN IMPRINT OF ELSEVIER SCIENCE AMSTERDAM BOSTON LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO
Foreword xv Preface xvii Color Insert following page 298 Chapter 1 Introduction 1 1.1 Perception 2 1.2 The Heri tage of Animation 4 1.2.1 Early Devices 4 1.2.2 The Early Days of "Conventional" Animation 6 1.2.3 Disney 7 1.2.4 Contributions of Others 9 1.2.5 Other Media for Animation 9 1.2.6 Principles of Computer Animation 10 1.3 Animation Production 12 1.3.1 Computer Animation Production Tasks 15 Vll
viii 1.3.2 Digital Editing 17 1.3.3 Digital Video 20 1.4 A Brief History of Computer Animation 21 1.4.1 Early Activity 21 1.4.2 TheMiddleYears 24 1.4.3 Animation Comes ofage 26 1.5 Chapter Summary 29 References 29 Chapter 2 Technical Background 31 2.1 Spaces and Transformations 31 2.1.1 The Display Pipeline 32 2.1.2 Homogeneous Coordinates and the Transformation Matrix 36 2.1.3 Compounding Transformations: Multiplying Transformation Matrices 39 2.1.4 Basic Transformations 40 2.1.5 Representing an Arbitrary Orientation 42 2.1.6 Extracting Transformations from a Matrix 45 2.1.7 Description of Transformations in the Display Pipeline 46 2.1.8 Round-off Error Considerations 48 2.2 Orientation Representation 51 2.2.1 Fixed Angle Representation 53 2.2.2 Euler Angle Representation 56 2.2.3 Angle and Axis 57 2.2.4 Quaternions 58 2.3 Chapter Summary 61 References 61 Chapter 3 Interpolation and Basic Techniques 63 3.1 Interpolation 63 3.1.1 The Appropriate Function 64 3.2 Controlling the Motion Along a Curve 68
ix 3.2.1 Computing Are Length 69 3.2.2 Speed Control 84 3.2.3 Ease-in/Ease-out 86 3.2.4 Constant Acceleration: Parabolic Ease-In/ Ease-Out 89 3.2.5 General Distance-Time Functions 92 3.2.6 Curve Fitting to Position-Time Pairs 94 3.3 Interpolation of Rotations Represented by Quaternions 97 3.4 Path Following 102 3.4.1 Orientation along a Path 102 3.4.2 Smoothing a Path 108 3.4.3 Determining a Path along a Surface 114 3.5 Key-Frame Systems 116 3.6 Animation Languages 120 3.6.1 Artist-Oriented Animation Languages 121 3.6.2 Articulation Variables 122 3.6.3 Graphical Languages 123 3.6.4 Actor-Based Animation Languages 123 3.7 Deforming Objects 124 3.7.1 Warping an Object 125 3.7.2 Coordinate Grid Deformation 125 3.8 Morphing(2D) 143 3.8.1 Coordinate Grid Approach 143 3.8.2 Feature-Based Morphing 148 3.9 3D Shape Interpolation 153 3.9.1 Matching Topology 157 3.9.2 Star-Shaped Polyhedra 157 3.9.3 Axial Slices 159 3.9.4 Map to Sphere 160 3.9.5 Recursive Subdivision 166 3.9.6 Summary 169 3.10 Chapter Summary 169 References 170
Chapter4 Advanced Algorithms 173 4.1 Automatic Camera Control 174 4.2 Hierarchical Kinematic Modeling 175 4.2.1 Representing Hierarchical Models 177 4.2.2 Forward Kinematics 184 v 4.2.3 Local Coordinate Frames 185 > 4.2.4 Inverse Kinematics 192 4.2.5 Summary 203 4.3 Rigid Body Simulation 203 4.3.1 Bodies in Free Fall 204 4.3.2 Bodies in Contact 216 4.4 Enforcing Soft and Hard Constraints 231 4.4.1 Flexible Objects 232 4.4.2 Virtual Springs 235 4.4.3 Energy Minimization 236 4.4.4 Space-Time Constraints 239 4.5 Controlling Groups of Objects 241 4.5.1 Particle Systems 242 4.5.2 Flocking Behavior 246 4.5.3 Autonomous Behavior 257 4.6 Implicit Surfaces 261 4.6.1 Basic Implicit Surface Formulation 261 4.6.2 Animation Using Implicitly Defined Objects 263 4.6.3 Collision Detection 264 4.6.4 Deforming the Implicit Surface as a Result of Collision 265 4.6.5 Summary 267 4.7 Chapter Summary 267 References 268 Chapter 5 Natural Phenomena 271 with contributions by David S. Ebert 5.1 Plants 272 5.1.1 A Little Bit of Botany 273 5.1.2 L-Systems 275
XI 5.1.3 Animating Plant Growth 280 5.1.4 Summary 283 5.2 Water 283 5.2.1 Still Waters and Small-Amplitude Waves 284 5.2.2 The Anatomy of Waves 288 5.2.3 Modeling Ocean Waves 289 5.2.4 Finding Its Way Downhill 292 5.2.5 Summary 296 5.3 Gaseous Phenomena 296 5.3.1 General Approaches to Modeling Gas 296 5.3.2 Computational Fluid Dynamics 298 5.3.3 Clouds 299 5.3.4 Fire 310 5.3.5 Summary 311 5.4 Chapter Summary 312 References 312 Chapter 6 Modeling and Animating Articulated Figures 317 with contributions by Meg Geroch, Scott King, Matt Lewis, and Doug Roble 6.1 Reaching and Grasping 318 6.1.1 Modeling the Arm 318 6.1.2 The Shoulder Joint 321 6.1.3 The Hand 321 6.1.4 Coordinated Movement 324 6.1.5 Reaching Around Obstacles 325 6.1.6 Strength 326 6.2 Walking 327 6.2.1 The Mechanics of Locomotion 328 6.2.2 The Kinematics of the Walk 333 6.2.3 Using Dynamics to Help Produce Realistic Motion 336 6.2.4 Forward Dynamic Control 338 6.2.5 Summary 339 6.3 Facial Animation 339 6.3.1 Types of Facial Models 341 6.3.2 Creating the Model 342
xii 6.3.3 Textures 345 6.3.4 Approaches to Animating the Face 347 6.4 Overview of Virtual Human Representation 353 6.4.1 Representing Body Geometry 354 6.4.2 Geometry Data Acquisition 356 6.4.3 Geometry Deformation 356 6.4.4 Clothing 357 6.4.5 Hair 357 6.4.6 Surface Detail 358 6.5 Layered Approach to Human Figure Modeling 358 6.6 Cloth and Clothing 361 6.6.1 Simple Draping 362 6.6.2 Getting into Clothes 365 6.7 Motion Capture 369 6.7.1 Processing the Images 371 6.7.2 Camera Calibration 372 6.7.3 3D Position Reconstruction 373 6.7.4 Fitting to the Skeleton 376 6.7.5 Modifying Motion Capture 378 6.7.6 Summary 378 6.8 Chapter Summary 379 References 379 Appendix A Rendering issues 385 A.1 Double Buffering 385 A.2 Compositing 386 A.2.1 Compositing without Pixel Depth Information 389 A.2.2 Compositing with Pixel Depth Information 395 A.3 Dispiaying Moving Objects: Motion Blur 398 A.4 Drop Shadows 401 A.5 Summary 406 References 406
xm Appendix B Background Information and Techniques 409 B.l Vectors and Matrices 409 B. 1.1 Inverse Matrix and Solving Linear Systems 411 B.1.2 Singular Value Decomposition 419 B.2 Geometrie Computations 420 B.2.1 Components of a Vector 420 B.2.2 Lengthofa Vector 420 B.2.3 Dot Product of Two Vectors 420 B.2.4 Cross Product of Two Vectors 422 B.2.5 Vector and Matrix Routines 424 B.2.6 Closest Point between Two Lines in Three-Space 427 B.2.7 Area Calculations 428 B.2.8 The Cosine Rule 429 B.2.9 Barycentric Coordinates 430 B.2.10 Computing Bounding Shapes 431 B.3 Transformations 447 B.3.1 Transforming a Point Using Vector-Matrix Multiplication 447 B.3.2 Transforming a Vector Using Vector-Matrix Multiplication 448 B.3.3 Axis-Angle Rotations 449 B.3.4 Quaternions 450 B.4 Interpolating and Approximating Curves 453 B.4.1 Equations: Some Basic Terms 453 B.4.2 Simple Linear Interpolation: Geometrie and Algebraic Forms 454 B.4.3 Parameterization by Are Length 456 B.4.4 Computing Derivatives 456 B.4.5 Hermite Interpolation 457 B.4.6 Catmull-Rom Spline 458 B.4.7 Four-Point Form 461 B.4.8 Blended Parabolas 462 B.4.9 Bezier Interpolation/Approximation 463 B.4.10 De Casteljau Construction of Bezier Curves 464 B.4.11 Tension, Continuity, and Bias Control 465 B.4.12 B-Splines 467
B.4.13 Fitting Curves to a Given Set of Points 469 5 Randomness 470 B.5.1 Noise 471 B.5.2 Turbulence 474 B.5.3 Random Number Generator 474 6 Physics Primer 476 B.6.1 Position, Velocity, and Acceleration 476 B.6.2 Circular Motion 477 B.6.3 Newtons Laws of Motion 478 B.6.4 Inertia and Inertial Reference Frames 479 B.6.5 Center of Mass 479 B.6.6 Torque 480 B.6.7 Equilibrium: Balancing Forces 480 B.6.8 Gravity 480 B.6.9 Centripetal force 481 B.6.10 Contact Forces 481 B.6.11 Centrifugal Force 483 B.6.12 Work and Potential Energy 484 B.6.13 Kinetic Energy 484 B.6.14 Conservation of Energy 484 B.6.15 Conservation of Momentum 484 B.6.16 Oscillatory Motion 485 B.6.17 Damping 486 B.6.18 Angular Momentum 486 B.6.19 Inertia Tensors 487 7 Numerical Integration Techniques 488 B.7.1 Function Integration 488 B.7.2 Integrating Ordinary Differential Equations 489 8 Standards for Moving Pictures 493 B.8.1 In the Beginning, There Was Analog 493 B.8.2 In the Digital World 497 9 Camera Calibration 502 References 507 Index 509 About the Author 529