Performance of Physics-Driven Procedural Animation of Character Locomotion for Bipedal and Quadrupedal Gait
Total Page:16
File Type:pdf, Size:1020Kb
Thesis no: MECS-2015-03 Performance of Physics-Driven Procedural Animation of Character Locomotion For Bipedal and Quadrupedal Gait Jarl Larsson Faculty of Computing Blekinge Institute of Technology SE371 79 Karlskrona, Sweden This thesis is submitted to the Faculty of Computing at Blekinge Institute of Technology in partial fulllment of the requirements for the degree of Master of Science in Engineering: Game and Software Engineering. The thesis is equivalent to 20 weeks of full-time studies. Contact Information: Author: Jarl Larsson E-mail: [email protected] University advisors: Ph.D. Veronica Sundstedt Ph.D. Martin Fredriksson Department of Creative Technologies Faculty of Computing Internet : www.bth.se Blekinge Institute of Technology Phone : +46 455 38 50 00 SE371 79 Karlskrona, Sweden Fax : +46 455 38 50 57 Abstract Context. Animation of character locomotion is an important part of computer animation and games. It is a vital aspect in achieving be- lievable behaviour and articulation for virtual characters. For games there is also often a need for supporting real-time reactive behaviour in an animation as a response to direct or indirect user interaction, which have given rise to procedural solutions to generate animation of locomotion. Objectives. In this thesis the performance aspects for procedurally generating animation of locomotion within real-time constraints is evaluated, for bipeds and quadrupeds, and for simulations of sev- eral characters. A general pose-driven feedback algorithm for physics- driven character locomotion is implemented for this purpose. Methods. The execution time of the locomotion algorithm is evalu- ated using an automated experiment process, in which real-time gait simulations of incrementing character population count are instanti- ated and measured, for the bipedal and quadrupedal gaits. The sim- ulations are measured for both serial and parallel executions of the locomotion algorithm. Results. Simulations of up to and including 100 characters are per- formance measured providing an overview of the slowdown rate when increasing the character count in the simulations, as well as the per- formance relations between bipeds and quadrupeds. Conclusions. The experiment concludes that the evaluated algo- rithm on its own exhibits a relatively small performance impact that scales almost linearly for the evaluated population sizes. Due to the relatively low performance impacts it is thus also concluded that for fu- ture experiments a broader measurement of the locomotion algorithm that includes and compares dierent physics solvers is of interest. Keywords: Procedural animation, Interactive games, Multithread- ing, Software performance i Acknowledgements Warm thanks to my family and friends, near and dear; for all your support and encouragement! Big thanks to my supervisors, Veronica Sundstedt and Martin Fredriksson, for guiding me through this project. Lastly, a special thanks to Michiel van de Panne for the insightful answers to my questions about procedural locomotion. ii Contents Abstracti 1 Introduction1 1.1 Procedural Articulation.......................2 1.2 Procedural Terrestrial Locomotion..................4 1.3 Problem Statement..........................6 1.3.1 Aims and Objectives.....................7 1.4 Research Question..........................8 1.5 Method Introduction.........................8 1.6 Contribution..............................8 1.7 Thesis Outline.............................8 2 Background and Related Work 10 2.1 Locomotion.............................. 11 2.1.1 Believability in Animation.................. 11 2.1.2 Terrestrial Locomotion Terminology............. 11 2.2 Dynamics-Driven Procedural Locomotion.............. 12 2.2.1 Inverted Pendulum Methods................. 14 2.2.2 Muscle-Driven Methods................... 14 2.2.3 Pose-Driven Feedback Methods............... 15 2.3 Parallel Execution of Locomotion Algorithm............ 16 2.4 Performance in Parallel Algorithms................. 16 2.5 Summary............................... 17 3 Implementation 18 3.1 Implemented Algorithm....................... 18 3.1.1 Gait Player.......................... 21 3.1.2 Virtual Forces......................... 21 3.1.3 Leg Frame and Torque Feedback.............. 22 3.1.4 Legs.............................. 23 3.1.5 Gravity Compensation.................... 24 3.1.6 Foot Placement........................ 25 3.1.7 Proportional-Derivative Controllers............. 26 3.2 Constrained Rigid Bodies using BulletPhysics........... 26 iii 3.3 Optimization............................. 26 3.4 Controller Logic............................ 28 3.5 Summary............................... 30 4 Method 32 4.1 Scenarios and Parameters...................... 32 4.2 Technology.............................. 35 4.3 Validity Threats............................ 36 4.4 Summary............................... 37 5 Results 38 5.1 Observations.............................. 38 5.1.1 Measurements......................... 38 6 Analysis 42 6.1 Serial Results Analysis........................ 42 6.2 Parallel Results Analysis....................... 44 6.3 Trends and Relations......................... 44 6.4 Summary............................... 46 7 Conclusions and Future Work 48 7.1 Thesis Summary........................... 48 7.2 Method and Implementation Discussion............... 49 7.3 Conclusions.............................. 50 7.4 Contribution and Comparisons.................... 51 7.5 Future Work.............................. 51 References 53 iv Chapter 1 Introduction Character locomotion is a common subject within the domains of computer ani- mation and games. Locomotion is the description of how propulsive movement is achieved by a body, for animals this translates to the resulting movement pattern of their limbs and frames. Terrestrial animal locomotion, more specically, is the way in which an animal self-propel on land by, for example, walking or running. This kind of locomotion and its subsequent animation is common for characters that moves around in modern computer games. Characters in computer games are often displayed as a collection of connected polygons and vertices, and thus needs some form of high-level abstracted control layer to express motions on a per-leg or per-arm level. Animation of polygon based characters in computer games are thus often realized and simplied by means of morphing [30,35] or skeletal animation [39]. Both are control techniques used to transform the multitude of vertices of a 3D model, frame-by-frame, in order to animate it. Both techniques interpolates between keyframes of animation data. Morphing needs transformed copies of the model for each pose to morph to, while skeletal animation lets the animator control an approximation of the char- acter to be animated. This approximation, a hierarchy of segments, is called a skeleton (it can be likened to the common poseable wooden mannequins used by artists). By approximating the character to be animated, the animator will not have to displace each vertex manually. The segments in the skeleton are referred to as bones. Each bone describes a limb transformation, as a function of time, for the character. Each vertex in the character model belongs to one or several bones (with weighted priorities) and will follow their transformations. Skeletal animation and morphing can be combined in various ways as well, depending on the application. By using a skeleton, one can thus control separate limbs on a character on a high level. Animation of locomotion can then be done on a per-leg basis. Even though skeletal animation might lessen the amount of parameters to con- trol for transforming and animating character geometry, the full range of motions exerted by one character alone can become a lot. A computer game featuring a rich amount of characters with varying skeleton layouts for animation may thus require vast amounts of manual animation work for only various forms of locomo- 1 Chapter 1. Introduction 2 Character Topic Animation Transformation Method Skeletal Morphing Data Generation Method Procedural Keyframed Head & Eye Full Body & Rag Grasping & Articulation Area Locomotion Reactions Dolls Reaching Pose Driven Kinematic & Semi- Musculoskeletal Inverted Procedural Method Feedback procedural/ Dynamics Dynamics Parametric Pendulum Biped & Leggedness Others (spiders, Quadruped insects, etc) Figure 1.1: Flowchart of domains related to the topic of character animation. Represented as an hierarchical structure, the chart is read from top to bottom and visualizes the various ways in which a specic domain can branch. Domains for leaf nodes to the right are not focused upon in this thesis. tion alone [21, 39]. When these game characters are expected to work in a large variety of environments and situations one more or less have to have some form of procedural animation component [46]. Not only to alleviate the animators of an exaggerated amount of manual keyframe animation labour, but also to minimize the memory footprint of the application [39]. Procedural animation solutions can manifest themselves in many dierent forms depending on the problem and platform. Figure 1.1 presents a hierarchical view of various domains within the topic of character animation and how this thesis will present them. Here procedural animation is separated from keyframed animation. The following section (Section 1.1) will introduce the various com- binable ways a character can express itself through motions; its articulations (Figure 1.1), of which one is