Full text
1 MASTER THESIS: MOTION ENRICHING USING HUMANOIDE CAPTURED MOTIONS STUDENT: SINAN MUTLU ADVISOR: ANTONIO SUSÌN SÀNCHEZ SEPTEMBER, 8TH 2010 COURSE: MASTER IN COMPUTING LSI DEPERTMANT POLYTECNIC UNIVERSITY OF CATALUNYA
2 Abstract Animated humanoid characters are a delight to watch. Nowadays they are extensively used in simulators. In military applications animated characters are used for training soldiers, in medical they are used for studying to detect the problems in the joints of a patient, moreover they can be used for instructing people for an event(such as weather forecasts or giving a lecture in virtual environment). In addition to these environments computer games and 3D animation movies are taking the benefit of animated characters to be more realistic. For all of these mediums motion capture data has a great impact because of its speed and robustness and the ability to capture various motions. Motion capture method can be reused to blend various motion styles. Furthermore we can generate more motions from a single motion data by processing each joint data individually if a motion is cyclic. If the motion is cyclic it is highly probable that each joint is defined by combinations of different signals. On the other hand, irrespective of method selected, creating animation by hand is a time consuming and costly process for people who are working in the art side. For these reasons we can use the databases which are open to everyone such as Computer Graphics Laboratory of Carnegie Mellon University. Creating a new motion from scratch by hand by using some spatial tools (such as 3DS Max, Maya, Natural Motion Endorphin or Blender) or by reusing motion captured data has some difficulties. Irrespective of the motion type selected to be animated (cartoonish, caricaturist or very realistic) human beings are natural experts on any kind of motion. Since we are experienced with other peoples’ motions, and comparing each motion to the others, we can easily judge one individual’s mood from his/her body language. As being a natural master of human motions it is very difficult to convince people by a humanoid character’s animation since the recreated motions can include some unnatural artifacts (such as foot-skating, flickering of a joint). Our work is focused to reuse the original motion by the following ways: • Changing path of a single motion to get another motion which moves on a different path.
3 • Analyzing each joint’s motion by signal processing and by changing coefficients of each signal for defining a different motion. • Blending a walking/running character with different moods (such as sad, happy or relaxed). It is possible that all the methods mentioned above end up with some artifacts such as foot-skating. To overcome this problem we proceed in our work to find a way for clearing unnatural parts of a motion by: • Detecting the foot planted times of a moving character. • Clearing the foot-skates by using Analytic Inverse Kinematic library. We implemented all of these by benefiting from the asf/amc viewer of Computer Graphics Laboratory of Carnegie Mellon University which was able to import only one character. Keywords: computer graphics, computer animation, mocap, motion capture, motion editing, inverse kinematics, motion graphs, quaternions, blending, Fourier Transform, signal processing.
4 TABLE OF CONTENTS Abstract ......................................................................................................................... 2 CHAPTER I .................................................................................................................... 8 INTRODUCTION .......................................................................................................... 8 1.1 Goals ....................................................................................................................... 9 CHAPTER II ................................................................................................................. 12 BACKGROUND ........................................................................................................... 12 2.1 Early Days of Animation ...................................................................................... 12 2.2 Character Animation ............................................................................................. 13 2.2.1 Key Frame Animation ................................................................................... 14 2.2.2 Motion Capture Animation ............................................................................ 16 2.2.3 Procedural Animation .................................................................................... 17 2.2.4 Behavioral Animation .................................................................................... 22 2.3 Hierarchical Structure ........................................................................................... 23 2.3.1 ASF/AMC File Format .................................................................................. 25 2.4 Rotations in 3D ..................................................................................................... 26 2.5 Fourier Transforms ............................................................................................... 28 2.6 Autocorrelation ..................................................................................................... 30 2.7 Foot Plant Detection ............................................................................................. 31 2.8 Motion Graphs ...................................................................................................... 33 2.9 Motion Blending ................................................................................................... 36 2.10 Motion Path Editing ............................................................................................ 40 CHAPTER III ............................................................................................................... 43 IMPLEMENTATION METHODS ............................................................................. 43 3.1 Methods implemented in the Work ...................................................................... 43 3.2 System Architecture .............................................................................................. 44 CHAPTER IV ............................................................................................................... 47 RESULTS AND IMPLEMENTATION DETAILS ................................................... 47 4.1 Foot Plant Detection ............................................................................................. 47 4.1.1 Using Displacements and Velocities ............................................................. 48 4.1.1 Using Knee Rotation Angles ......................................................................... 54 4.2 Motion Blending ................................................................................................... 58 4.3 Motion Path Editing .............................................................................................. 64 4.4 Motion Editing with Signal Processing Methods ................................................. 69 4.5 Predicting the Period of a Cyclic Motion ............................................................. 74 CHAPTER V ................................................................................................................. 79 CONCLUSIONS ........................................................................................................... 79 CHAPTER VI ............................................................................................................... 81 FUTURE DIRECTIONS .............................................................................................. 81 REFERENCES.............................................................................................................. 82
5 LIST OF FIGURES Figure 2.1: Thuamatrope, Zeatrope and Kinetoscope ..................................................... 13 Figure 2.5: Normalized Walk Cycle [32] ....................................................................... 20 Figure 2.6: New configuration (left), applying cosine rules (right) ................................ 21 Figure 2.7: Sequential IK results for a boxing character [23]. ....................................... 22 Figure 2.8: Structure of behavioral model ...................................................................... 23 Figure 2.9: Example of a hierarchical representation [10] ............................................. 24 Figure 2.10: Rotations at joints [10] ............................................................................... 24 Figure 2.10: asf file humanoid hierarchical representation ............................................ 25 Figure 2.11: Critical sampling of the sine wave. Sampling at a lower rate will result loss of sine wave property. ..................................................................................................... 29 Figure 2.12: A plot showing 100 random numbers with a hidden sine function and autocorrelation of this data is on the bottom image. .............................................................. 31 Figure 2.13: Foot joints ................................................................................................... 32 Figure 2.14: An example for vertical position of a ankle joint, as it can be seen from the figure it is difficult to decide on a threshold value [47]. ................................................. 33 Figure 2.15: Constructing a directed graph using similar poses [50] ............................. 34 Figure 2.16: Similar poses clustered into same groups [50]. .......................................... 36 Figure 2.17: A cluster tree is constructed for a motion frame by traversing the motion graph to identify clusters reachable within a given depth ( 6 transitions for this figure) [50]. ................................................................................................................................. 36 Figure 2.18: Vertex correspondence problem and cost functions [53]. .......................... 38 Figure 2.19: Applying time-warp [53]. ........................................................................... 38 Figure 2.20: Frame alignment between two motions [56]. ............................................. 39 Figure 2.21: Blending two types of walk with (bottom) and without (top) considering time-warp [53]. ............................................................................................................... 40 Figure 2.22: Editing a path of normal walk motion, left image shows the normal original motion, right one shows the edited one [58]. .................................................................. 40 Figure 2.23: The top shows the original motion of a character which is picking up a box and carrying it. The lower one shows the motion after user manipulated the walking path. Note that rectangles are defining the inflexible regions (tiles) which are connecting the Bèzier splines (flexible regions) [59]. ....................................................................... 41 Figure 3.3: Motion Blending Diagram ........................................................................... 46 Figure 3.4: Path Editing Diagram ................................................................................... 46 Figure 4.1: Example of an right foot plant interval: right-heel strike (first), right toestrike (second), right heel-off (third), right toe-off (fourth)............................................ 48 Figure 4.2: Steps of detecting and removing noise from data ........................................ 50 Figure 4.3: Process of Step 4 .......................................................................................... 51 Figure 4.4: Merging small stance intervals. .................................................................... 51 Figure 4.5: Knee rotation values in X axis for marching_01.amc motion ...................... 54 Figure 4.6: Knee X Axis rotation degrees for drunk_01.amc with 584 frames. ............. 55 Figure 4.7: Finding local min-max by a window centered at a key frame, drunk_01.amc ........................................................................................................................................ 56 Figure 4.8: Right Knee rotation of drunk_01.amc after removing small frequencies .... 57 Figure 4.9: Mapping one stance interval onto the other one........................................... 58 Figure 4.10 Partitioning skeleton into groups ................................................................. 59 Figure 4.11: Marching animation (left_stance, double stance, right_stance) ................. 59
6 Figure 4.12: Normal walking cycle (left), blending result of marching and normal walking cycle (right) ....................................................................................................... 60 Figure 4.13: Normal walking character (right), blending result for lower body [)0.1,_,_( __ walkmarchingwalknormal bodylowerbodylowerslerp ] (middle), both animations at the same key-frame (right) .................................................................................................... 61 Figure 4.14: Normal walk (left), blending result for lower body [)5.0,_,_( __ walkmarchingwalknormal bodylowerbodylowerslerp ] (middle), both animation at 46th key-frame (right) ............................................................................................................. 62 Figure 4.15: Blending all body of a normal walk with marching ()5.0,_,_( __ walkmarchingwalknormal bodyallbodyallslerp (left), blending lower body )0.1,_,_( __ walkmarchingwalknormal bodylowerbodylowerslerp (right) ......................................... 63 Figure 4.16: Changing motion path with Hermite splines .............................................. 65 Figure 4.17:First raw depicts the skateboard duck under motion for initial frame and for ........................................................................................................................................ 66 frame 235. On the second raw motion path altered using the control points (colored ones). ............................................................................................................................... 66 Figure 4.18: Changing the path of normal walk motion (first raw), Right foot stance (second raw). Red line shows the right heel strike position. Right foot is put inside a yellow circle. ................................................................................................................... 66 Figure 4.19: Skeleton Model for End Effector Cleanup [30] ......................................... 67 Figure 4.20: A constraint on a foot will make the root the projection closer to t1, if the other foot is only constrained one root’s projection will be closer to t2. On the other hand if both of them are constraint root projection will be at t3 [30]. ............................ 68 Figure 4.21: Straight running animation before path editing (left) and after path editing (right) .............................................................................................................................. 68 Figure 4.22: X axis rotation of foot joint in a normal walk animation taken from a motion of CMU motion database. ................................................................................... 69 Figure 4.23: X axis rotation of the root joint after smoothing the signal. ...................... 70 Figure 4.24: After multiplying all the frequencies in the new signal with 1.25. Local max and local min are closer to the original motion. ...................................................... 70 Figure 4.25: First three frames are the 1st key-frame of the initial walking animation. Second frames screenshots are the 1st key-frame from front, left and right when the initial motion signals are multiplied with 1.5. ................................................................ 71 Figure 4.26: After the femur and shoulder joints are corrected. ..................................... 72 Figure 4.27: Low pass pyramid (left), band pass pyramid (right) .................................. 72 Figure 4.27: Rotation around Y axis of lower back joint in a normal walk. ................... 73 Figure 4.28: Rotation around Y axis of lower back joint when we put 7.58 to band 6, 7 and 8 in a normal walk. ................................................................................................... 74 Figure 4.29: In the same key-frame normal walk (purple), and after manipulating the lower back joint band passes with about coefficients. .................................................... 74 Figure 4.30: Result of autocorrelation method for knee rotation around X axis. ........... 76
7 LIST OF TABLES Table 4.1: Threshold Evaluation Table Structure ........................................................... 49 Table 4.2: For 07_01.amc automatic foot plant intervals detection results (left) and manually checked results (right) ..................................................................................... 51 Table 4.3: Automatic foot plant intervals detection for relaxed_01.amc (left) and manual detection (right) .................................................................................................. 52 Table 4.4: Automatic foot plant detection for marchin_01.amc (left) and manual detection (right) ............................................................................................................... 52 Table 4.5: After applying velocity cooperation to joints ................................................ 53 Table 4.6: Fundamental frequencies for some joints of a motion with 316 key-frames. 75 Table 4.7: Result of the autocorrelation method for same walking motion.................... 76 Table 4.8: Fundamental frequencies for some joints of a motion with 413 key-frames. 76 Table 4.9: Result of the autocorrelation method for marching walking motion with 413 key-frames. ..................................................................................................................... 77 Table 4.10: Fundamental frequencies for some joints of a cyclic rush motion with 189 key-frames. ..................................................................................................................... 77 Table 4.11: Fundamental frequencies for some joints of a rush motion with 189 keyframes. ............................................................................................................................. 77
8 CHAPTER I INTRODUCTION In the most general sense, “animate” means “give life to” and includes live-actions puppetry such as that found on Sesame Street. In the early days of the animation history before the era of cinema and John von Neumann computer architecture people invented some tools to create some basic animations. With the arise of today’s computers in digital medium 3D artists and researchers start to produce animated characters and process motion data, which we are used to see in computer games digital animation movies and in strategic simulators. Today one of the biggest challenges in computer games, film industry and all other fields in which humanoid motion has a place to visualize, is creating animated character from scratch by using some spatial tools or reusing the existing motions by processing them. Apart of being very realistic or cartoonist results, recreated/processed humanoid animations have to be believable. Since human observers are very sensitive to motion as been natural experts, it demands tremendous skills to satisfy them. There are different ways of creating humanoid animations such as procedural animation (using ragdoll physics and forces to move the character), key-frame animation (giving the positions of a trajectory for some key time intervals and then interpolating these positions for undefined times), and motion capture (mocap – recording the movements of a real object/human by using some devices). Among these examples of methods mocap has become more popular since its robustness, easy to capture realistic motions with different styles of motion. Whatever method is selected, it is still challenging to create a motion, for example if our character has to pass from one type of motion to another such as from walking to running or from straight walk to sudden turns to left/right or back. In these transitions it
9 is difficult to keep the continuity of joints’ movements. Another example is: if a motion data which goes forward and if we need same motion (depressed walk) following another path, it will be waste of time to design it from scratch. For this kind of example in low level animator has to select appropriate key-frames in the existing motions to construct a new one. Then he/she has to smooth the new generated one. Since this process gets a lot of time it can be a bottleneck in development of the applications. 1.1 Goals In this study we tried to develop an environment which is processing the existing motions (mocap files in asf/amc format) by using various techniques to get a new motion. The techniques we used for this purpose are: a) Analyzing motion with signal processing methods: If a motion is cyclic, it gives the chance to analyze each joint data using the techniques in signal processing. In a normal cyclic walking mocap data for each degree of freedom (DOF) of a joint we can produce other behaviors for that joint. For instance if we consider one DOF data of a joint as an original signal, most probably this is the sum of other signals. Therefore by the help of Fourier analysis behaviour of that joint can be changed. As a result of different filters motion of a joint can be exaggerated as well as the fact that it can be smoothed. Or changing the coefficients of existing signals in the original one will define another motion. Furthermore Fourier analysis and autocorrelation methods can be used to detect the period of the cyclic motion. b) Motion Path Editing: A path is an abstraction of positional movement of a character, which is different from, but related to, the orientation of the character as it moves along the path. This abstraction leads to the idea of representing a motion relative to the path, allowing the path to be altered and the motion to be adjusted accordingly (M.Gleicher). For instance, a character can move in a straight line, so by editing this path it is possible to make the character to move in a curved path by preserving the detail and nuance of the original motion. Dancing characters can be another good
16 2.2.2 Motion Capture Animation Recording and a mapping of a motion of a real object to a syntactic object is called motion capture. It involves sensing digitizing and recording of an object’s motion, not its visual appearance [22]. Using this method has some advantages such that it is rapid and even real time, the amount of work does not vary with complexity or length of the performance, the amount of animation data that can be created within a given time is extremely large when compared to traditional techniques, complex movements such as physical interactions can be recorded. Conversely, by using other techniques, such as key-framing, inverse kinematics and forward kinematics, trying to get the same result which we can get from motion capture is frustrating. This method is mimicking the key-framing technique since the motion of an actor is sampled many times for a second. Still it has some difficulties and disadvantages, such as, specific hardware and special programs are required to obtain and process the data, the cost of the software, equipment and personnel requirement can potentially be prohibitive for small productions, the capture system may have specific requirements for the space it is operated in, depending on camera field of view or magnetic distortion. These are just some of the disadvantages of these systems. In this technology, there are two approaches used so far: electromagnetic sensors and optical trackers. In the former type of approach sensors are placed at each joint that they are transmitting their positions and orientations back to central processor to record their movements. For doing this, sensors have to use cables or wireless transmitters. With some latency the orientation and positions of sensors can be rendered, on the other hand the drawbacks relate to the range and accuracy of magnetic field and the restricted movements. Optical markers have much larger range and performers only have to wear reflective markers on their clothes. But this approach does not provide real time feedback, also being error prone (occluded markers) and being noisy are the other drawbacks. In recent years there are some approaches for reducing the number of optical markers and using inverse kinematics for detecting the position and orientation of the joints which are not represented by markers [23].
17 Still there are a lot of researches for making motion capture systems more accurate and cheaper. But thanks to groups who make their data free to access, researchers can create their own databases by processing these pre-recorded animation data. Figure 2.3: Mocap with electromagnetic sensors (left), with optical markers (right) 2.2.3 Procedural Animation Procedural Animation refers to generation of motion based on some sort of procedures rather than being pre-processed. It is a pretty huge subject and contains many different techniques. Animation is produced either by running a physically based simulator or finding the poses of an animated character considering some geometric constraints. In the former concept different results can be obtained by changing the forces which are applied on the animated character. In the latter concept it is possible to get a variety of results with changed speed, acceleration and positions of the joints. Using these methods gives less degree of control to the animator compare to the key-framing technique but on the other hand it is much faster method for creating animations. Depending on the solvers and constraints we defined realism can be improved. In the literature for creating some locomotion models some motions models are used. Here we will describe a few of them: a) Dynamic Simulation: In physically based animation forces are applied to each limb of the character that they have different mass values. Some forces may not relate to physics at all-they may model constraints that animator may wish to enforce on
18 the motion. There are two main types of dynamic animated character control: forward dynamics control and inverse dynamics control. The former method requires the forces and torque to be specified. For instance these forces can be applied if an event or stage is triggered, such as if the system detects maximum forward extension of a leg, it will change the forces and torques which are applied so far on the character’s leg [26], [28]. The latter method, inverse dynamics, introduces calculating the forces and torques to make a trajectory following a path [27], [18], [19]. To model the Newtonian physics and momentum rules can be used. For this kind of animation Simbicon [27] is one of the best examples. In Simbicon walking locomotion and running locomotion are represented as a finite state machine. Each state defines different poses of the character (left stance, right stance), during the simulation by applying torques on each joint, character is getting the next state’s pose after a while. For each state there is a defined time interval that simulated character has to go from one state to the next state, actually these time intervals define speed of the animated character. If the state finished earlier, system triggers the next state. In Simbicon rotating the joint/trajectories are done by proportional derivative controller: τ = Kp(θd – θ) – kd* θ, which is the other type of virtual springs. Here “θd” is the desired angle and “θ” is the current angle value of the joint. But if we just apply these forces, there is no guarantee to have a balanced character /ragdoll, for this reason a balance feedback is added into the system. θd= θd0 + Cd*D +Cv*V, is defining the balance feedback for the swing foot replacement. Where “θd” is the target angle used for proportional derivative (PD) at any time, “θd0” is the default fixed target as described in the finite state machine (FSM), “D” is the horizontal distance from the stance ankle to the centre of mass (COM), and “V” is the velocity of the COM. “Cd and Cv” are gain parameters which have to be tuned by hand. For us this part is the drawback of the system, since the animator should fit these values. These values are depending to the simulation environment (type of the terrain) and type of the character motion (normal walk, drunk walk, running). Mimicking the motion capture data is one of the advantages of the system. If the mocap data is periodic a FSM can be constructed, so this data can be imported into the system. Most of the full dynamic systems still have poor locomotion results. They seem like more robotic movements instead of human or cartoon character movements. Another example to this kind of systems is DANCE [19]. This open source software has its own PD controller. We can define the key poses for the ragdoll by importing a
19 mocap file or by using the inverse kinematic framework, after using these key poses we can prepare a state machine. For example jumping from a building, or protecting face from a coming object are a bit complicated simulations that just needs a few key poses in DANCE. To move from one pose to another system uses spring damper model. There are some simulations that can be done easily; on the other hand simulations such as walking locomotion, running locomotion or continuous movements are difficult since there is no internal feedback controller [29]. Figure 2.4: Finite State machine of walking cycle in Simbicon(left), elements of balance control strategy(right), (a) - relationship between torso, stance-hip, and swing-hip torques; (b) - centre of mass position and velocity [27]. b) Kinematic Simulation: For articulated humanoid character kinematics simulation is the study which does not consider mass and forces acting on it, mostly it involves positions, angles, speed and acceleration of the limbs of the character. So far in the literature mainly two methods are used: forward kinematics and inverse kinematics. In the first method world coordinates of a joint can be calculated by taking into account all the joints in the hierarchy including the starting one. Motion capture data information is an example for the forward kinematics that we just have each joint’s local rotation and root’s world coordinates. But without using data such as mocap, getting a figure to a configuration by specifying the joint parameters values can be tedious. For this kind of work Versatile Walk Engine is a good example [32]. In this work the findings of Neurophysiology and Biomechanics are used [33]. In the engine walking locomotion is represented as a cycle. You can see a normalized walking cycle in Figure 2.5.
20 Figure 2.5: Normalized Walk Cycle [32] In this system the toe phases are depending on the speed of the character which changes between [0.1 and 0.25], 0.10 is for the fastest speed and 0.25 is for the slowest speed. In the system for character speed and walk cycle frequency Inman law [33] is used, in which the cycle frequency is equal to 0.743√v. For the hips, knees, feet and spine movements some results of biomedical observations are used [Appendix B]. The system has a good performance for large crowd simulations, but if we consider characters individually they seem like perfect walking without a characteristic (mood). Conversely in the latter method, inverse kinematics, only the end positions for hierarchy has to be specified, and systems are calculating the required angles for each joint to get a configuration. In this method, if the system has a few constraints and many solutions then it is under-constrained. Conversely if the system has so many constraints and no solution, the system is called over-constrained. In the literature so far configuration of the hierarchy are calculated by using Analytic Inverse Kinematics and Jacobian. In the first one the joint values of a final desired pose can be determined by inspecting geometry of the linkage. In the “FootSkate Solver” library this method is used to find the constrained configuration of a character. Input system requires the limb lengths, root positions and the constrained end effectors’ positions. Then it tries to find angles of joints in a reachable distance [30].
21 Figure 2.6: New configuration (left), applying cosine rules (right) As it is shown in the above pictures if the user gives a new position (X, Y) for the hierarchy which was in the initial configuration, first and second angles can be found by cosine rules. In computer animation most mechanisms are too complex to allow an analytic solution. For this as in inverse dynamics the motion can be incrementally constructed. In each time step angles of each joint are recomputed to move the end effector to the goal position [23]. Most of the methods in inverse kinematics are using Jacobian [10]. If the computed Jacobian matrix is square matrix, and it has an inverse matrix, this inverse matrix can be used to get the desired joint angle. But if the inverse matrix does not exist, the system is singular and there is no solution for this configuration. As a solution we can change the configuration of the linkage a bit to avoid the singularity. But when the configuration is close to singularities even small changes in the angles can give numerical errors and trembling results. If the number of DOF is more than constraints we can define another matrix by multiplying Jacobian matrix by its inverse in the case of its rows are linearly independent, “pseudoinverse”. This approach will give a square matrix. While using Jacobian if big steps are taken in joint angle space the end effector may not reach to the goal position. Still “under-constrained” cases have some problems with singularities. As a solution in the literature there are few approaches proposed so far by adding more controls [31]. In one of these methods, damped least square [31], user is supplying parameters to reduce the sensitivity of the pseudoinverse. Performances and complexities of different inverse kinematics methods can be found in ([34]). Among these solutions selectively damped least square method has best results
22 in the case of multiple end effectors. In this method a filtering is applied to all singular vectors and damping is defined in terms of the difficulty of reaching to the target [34]. On the other hand Jacobian transpose method in the case of single end effector is very fast and easy to implement. According to the survey results of [30] in most of the methods still there are trembling problems when the goal point is very close to singularities. Producing animated hierarchies with inverse kinematics is difficult, since it can give solutions which do not seem like human movements. Moreover, if we put some degree constraints to the joints, there is no guarantee for the system to give a (humanlike) result. For instance in [23] the system gets the position of wrists, ankle, hip and head positions. Then it computes the whole body configuration by using sequential inverse kinematics, normally this will be a waste of time for an animator. But still the results lack of small details. Figure 2.7: Sequential IK results for a boxing character [23]. Animations that are created by dynamics are more realistic than the ones generated by kinematics. The main problem of dynamic simulation of humanoid character is that it is computationally very expensive. The other drawback is that animator has to tune parameters for different type of motions. In kinematics motions adding small detail (sadness, happiness) can be cumbersome. In both cases there is a lack of artistic talent. 2.2.4 Behavioral Animation In this type of animation, mental process of the humanoid character is simulated. To achieve the goal a locomotion system has to be implemented. On the top of the system there is a preceptor, depending on the triggered orders from here, behaviors and goal actions are loaded to the character. Depending on the selected behaviors character can
23 choose different styles of action, and these actions can be simulated by one of the animation type: key-framed, procedural or mocap [35], [36]). Figure 2.8: Structure of behavioral model As it can be seen from the above diagram virtual character is animated by a “motor controller” which gets the goal information from the AI interface on top of it. Before closing the “character animation types” section, we can say that each technique has its own place in the literature, depending on the needs of the applications. Procedural animation fits to physically realistic animation requirements; behavioral animation fits to crowd simulations where the detail of the motion is not so much important. Key-framing animation can be used to have artistic results (cartoon character movements), and motion capture data can be used whenever high realism is needed. But as stated in behavioral animation section, different kind of character animation techniques can be used considering the requirement of the realism. 2.3 Hierarchical Structure Hierarchical modeling is the representation of the organization of a group of objects in a tree like structure. In these structures such as the one used in motion capture system, root changes the world coordinate and orientation of all the system. Other joints are rotating around their ancestors. In human like hierarchical representations, each joint can have only one ancestor. To compute global coordinates of a point on a link, all the
24 joints starting from root up to the current one have to be taken into account. Different local rotation angles, degree of freedom (DOF), direction vector and length values for each joint have to be considered. Figure 2.9: Example of a hierarchical representation [10] Figure 2.10: Rotations at joints [10] To locate a vertex of Link 1 in world space first it has to be transformed by multiplying it with joint’s local rotation matrix, after this step result is multiplied with transformations, which were computed for up of the hierarchy. V1’ = T0*T1*R1(θ1)*V1 For a vertex on Link1.1 : V’1.1 = T0*T1*R1(θ1)T1.1*R1.1(θ1.1)*V1.1
25 2.3.1 ASF/AMC File Format Asf file is containing information about joint data field (length, axis, direction, DOF, limits) and organization of the hierarchy. First part holds information about each joint and in second part parent-child relation of joints is given [37]. As a starting point it should be known that asf file defines the default pose of the motion. Each pose defined in the amc file is calculated considering this default pose. In this way we don’t have to hold any information about previous frames. DOF data of each joint is given as “rx, ry or rz”. The order of these keywords in a joint field defines the order of rotation for the joint. The absence of dof field means the joint is not rotating. Nonetheless absence of rx, ry or rz means joint never has a rotation in that axis. This field contains the axis of rotation. Apart from root joint all other joints in the hierarchy contain rotation values and order in the axis field. Root axis field only depicts the order of rotation. For this reason, axis field has to be involved into global/local rotation computations. Figure 2.10: asf file humanoid hierarchical representation
32 Foot-plant problem can be solved using the current vertical distance and translation speed of the ankle and toe joints. For each frame in the animation, these thresholds are checked. The foot is considered to be stationary when its position and linear velocity is lower than the specified threshold. But this method can give inconsistent results for the noisy or badly calibrated motion capture data. In other cases e.g. if your motion is processed or blended with another motion we can have foot skate artifacts. For this kind of reasons in [47] adaptive positional threshold is used. In this method, different kinds of walking cycles and running cycles are normalized. For left heel and right heel depending on the style of the locomotion plant intervals are predicted. Since this method is working considering the prerecorded normalized cycles it can be a drawback if a new style of motion is loaded. On the other hand in ([4]) k nearest-neighbors classifier is used. This is an interactive method that at the beginning the user gives some key intervals to the system, or at the beginning system can predicts some of the key frames for the heels and toes. Then, depending on the result user corrects or eliminates some of the predictions done by the system, system continues learning over the remaining predictions. Its interactivity can be the disadvantage but for the motion data which is not including noise or foot skates, this interaction can be in the minimum level. Since detection foot plant intervals for noisy data is hard to be detected this algorithm can save a lot of time of an animator. One example to traditional methods is [48]. Here in vertical positions and joint speeds are used for detection. Since this system cannot work for non-clean motions, some constraints are given via user interface. Without knowing these intervals most of the motion processing cannot be accomplished. In [30] foot skates are cleaned by using this knowledge. In normal asf/amc motion capture file for the foot only ankle and toe joints are given. To use library of [30] we have to have to provide to the system heel and ball joints. Figure 2.13: Foot joints
33 Figure 2.14: An example for vertical position of a ankle joint, as it can be seen from the figure it is difficult to decide on a threshold value [47]. In our system we used vertical distances and user feedbacks for predicting foot plants. In addition to this, on a normal walking cycle since both feet cannot be in plant phase, it is checked in our system. Details of our implementation will be given in the next chapter. 2.8 Motion Graphs A motion graph is created in order to encapsulate connections among a database. In this graph, edges correspond to motion clips (sequence of motion frames) and nodes to choice points (specific frames) connecting these graphs. After selecting different frames, or windows of frames, and creating graphs of connections, a walk along the graph allows us to create new motions. Figure 2.15 illustrates the construction of a motion graph. Initially we have three clips of motion from database. There are different types of graph constructions; here we illustrate each frame as a node. In the same clip we do not consider frames for evaluation which are very close to each other in the same stance. If we evaluate all frames with each other it will take a lot of resources and time. There are different methods used to check how close the poses are of a character in two frames. In
34 [49] to calculate the similarity of two frames/poses weighted sum of squared distance between point clouds of poses are used. ∑ − i iizx wizx pTp 'min ,,,, 00 θθ θθ In the above formula 00 zx T, , θ is for finding a coordinate system for the two point clouds. It rotates a point p about the vertical (y) axis by θ degrees and then translates it by (00 ,zx ). The weights i wmay be chosen differently for some of joints to increase their importance. To calculate θ and 00 ,zx values please check [49]. Figure 2.15: Constructing a directed graph using similar poses [50] First-order Markov can be adopted for checking the similarities of two motions. A transition from one state to the next one only depends on the current state [50]. To check the similarities it is possible to take into account the joint angles and angular velocities of joints [50]. If this model is used it is possible to eliminate transitions from redundant velocities. 2 1 , 1 2 0,0, )log(),( ∑ = − +−= m k kijkjiji qqwppppd Where 3 0, Rpi∈is the translation position of the character at frame i, 3 ,Sq ki ∈is the orientation of joint k with respect to its parent in frame i, and joint angle differences are summed over m rotational joints. The value of )log( 1 ba qq− is a vector v such that a rotation of 2||v|| about the axis v v takes a body from orientation a qto orientation b q. Since we want to find the similarity of two poses, we do not need to take into account first part of the formula. First part of the formula is concerning the global position closeness of root joints. In this formula we can set different weights to give more importance to some of the joints. It is better to give higher values to shoulders, elbows,
35 knees, hips and spine. If we have previous knowledge on motion clips, such as foot stance intervals, we can use it to reduce the computation time. For instance, if a pose is in left stance interval and if the other one is in the right stance interval there cannot be a transition between these two frames. These two methods told so far are computationally expensive. The matrix of probabilities ij P computed one of these formulas needs )( 2 nO storage space for n motion clips. If the motion database is huge it will be a problem since the computation can take a lot of time. For these reasons we have to avoid checking the distances of some of the frames. One option is skipping dissimilar contact states and other one is avoiding dead ends. After computing the graph, strongly connected subcomponents can be found. Probably we will have one very large strongly connected component and relatively small components. If the small components are very small we assign zero to the probabilities in these small ones. The optimal decision on a motion graph which satisfies user constraints can be computationally expensive. Running two searches simultaneously from start state and from end state of the final motion (A* search) will increase the search performance by factor of two. Moreover it will reduce the memory allocation [51]. Another option for deciding on the optimal transitions using clusters. In [50] clusters are computed looking to the similarities of the frames. After grouping the frames into the clusters, and having the motion graph for each of the frame a cluster tree is constructed for different behaviors or choices. In the paper isometric Gaussian mixture model is used in which each cluster is an isometric multivariate Gaussian distribution with variable standard deviation. The aim of this model is keeping similar motion states within the same cluster [50] [52].
36 Figure 2.16: Similar poses clustered into same groups [50]. Figure 2.17: A cluster tree is constructed for a motion frame by traversing the motion graph to identify clusters reachable within a given depth ( 6 transitions for this figure) [50]. After detecting the transition path for a pose to the other one we have to smooth the transition by blending. 2.9 Motion Blending By blending several motions it is possible to have multiple motions simultaneously. This means that the final motion is a blend of all active motions. Each frame in the final motion is found by blending each joint of the character with the corresponding joints in the other motions (eg. shoulders are blended with shoulders, etc). Motion transition is also using “blending”, the difference lies in the fact that a transition is a temporary blend. When the decision of transition from one motion to another one is given a motion blend is started, but only for a certain transition length. For the starting frame the weight of the first motion is at highest (“1”) value and the second motion weight is lowest (“0”), and first of these values is decreasing while the second one’s weight is increasing when we progress on the transition interval. As mentioned above we wish to blend corresponding joints of the motions. If we have two motions: i m and j m, which are to be blended, former one has weight i wand the latter has weight wj . Then the blend position of the two motions ( ik J and jk J) are found by
37 ji ji ww ww + ⋅+⋅ =jkik kpos JJ J Equally for N animations blended together the position of the k’th joint can be computed by ∑ ∑ = =⋅ =N ii N iii w w k 0 0J Jkpos The rotation of a joint is represented by quaternions, thus it is possible to do linear blending by using spherical linear interpolations (Slerp). Having a starting quaternion s qand a quaternion b qto be blended, we can find the linear interpolation l q by b w b 1 ssl qqqq )( − = Where b wis the weight between 0.0 and 1.0 that determines how much b qshould be weighted according to s q. For blending more than two quaternions, we start by finding l q for the first two quaternions and then setting s q= l q and performing the above equation for the next quaternion. This is repeated until all quaternions blended. In [53] signal processing methods have been used for blending the motions, by introducing multi-resolution motion filtering to be applied to existing motion data. By adjusting gains of bands for each joint’s angles a reliable blend is constructed. This method suffers from being non-automatic and only working with two motions. In addition to this, general linear blending do not consider if one motion speed is faster than the other one. On the other hand, methods told in section 2.8 solve these problems by finding the closest transition frames and considering angular velocities of joints. But these methods are working for detecting the closest frames for transitions poses, but what happens if we want to blend two whole motions such as a happy walk and a sad walk? Since the speed of each motion can be different we have to find the closest frames in each stance intervals. In Bruderlin and Williams work [53] timewarp algorithm is used. The solution is decomposed in two steps: finding the optimal sample correspondence between the two signals, and applying warp. The vertex correspondence problem is defined as finding the globally optimal correspondence between the vertices (samples) of two signals: to each vertex of a signal, assign (at least) a vertex in the other signal such that a global cost function measuring the “difference” of two signals is
38 minimized. In this sense the problem is similar with shape blending and it is solved by dynamic programming optimization techniques [53]. Figure 2.18: Vertex correspondence problem and cost functions [53]. In this work Sederberg’s shape blending algorithm is used [54]. It measures the differences in “shape” of two signals by calculating how much work it takes to deform one signal into the other. The cost function consists of the sum of local stretching and bending work terms, the former involving two, the latter three adjacent vertices of each signal. Intuitively, cost depends on the distance difference between two adjacent vertices of one signal and two vertices of the other signal. Similarly for angle difference between three adjacent vertices on each signal defines the cost. After finding the lowest cost correspondence between vertices on two signals or motion curves, second part is to apply the warp for the optimal blending. As in speech recognition [55], three cases are applied: substitution, deletion and insertion. The warped signal is denoted by wB. If iAand j B are related by substitution it follows that i wB=j B . In the case of multiple samples of B correspond to one iA, i wB will be equal of the mean of the corresponding B signal values. In the case of multiple A sample values correspond to a single B signal value i wB is determined by computing a cubic B-spline distribution around the original j B value. Figure 2.19: Applying time-warp [53].
39 Glardon and Boulic based their time-warp algorithm ([56]) on considering different support phases and their durations (left heel stance, left toe stance, etc). According to their algorithm we want to blend two motions: motion A, where frames 1a fand 2a fdelimit a footprint phase, and motion B, having frames 1b fand 2b fdelimiting a similar footprint. According to the elapsed time t ∆ corresponding frames of a fand b fhas to be computed. Figure 2.20: Frame alignment between two motions [56]. Frequencies a Fand b Fare associated to motion A and B. Since motions may have different frequencies a Fchosen as the initial frequency F, and phase variable curr ϕ as described in their previous work ([57]). Then frame a fis determined using equation 2, where max f is the number of frames of each normalized motion sequence (walking running or jumping). tF prevcurr ∆+= ϕϕ (1) max ff curra ϕ = (2) The frame b fis computed by a linear interpolation between 1b f and 2b f with the blend weight parameter p, varying from “0” (motion A) to “1” (motion B), defined in equation 3. 12 aa ba ff ff p− − =(3) Finally, the frame to be displayed is computed by applying quaternion spherical interpolation (Slerp) between a fand b f, using parameter p.
40 Figure 2.21: Blending two types of walk with (bottom) and without (top) considering time-warp [53]. 2.10 Motion Path Editing Given a path corresponding to an initial motion we can factor the motion into the path and residual by placing the motion in the moving coordinate system defined by the path. Then path curve can be replaced by another one that animated character is following the new path [58]. Figure 2.22: Editing a path of normal walk motion, left image shows the normal original motion, right one shows the edited one [58]. In this work path transformation preserves certain aspects such as motion. For instance joint angles are unaffected by the process, but because of the transformation of the root joint the positions of the end effectors are not preserved [58]. When arc length between two control points is extended foot/feet will start slipping along the floor. For this
41 reason before processing the original motion foot plant intervals are needed to fix the new motion. Using the previously known foot stances new motion can be cleaned by using IK method [30]. But if the arc lengths are extended too much, foot skating intervals can be impossible to be fixed using IK method (Foot Skate Solver) since its legs cannot be extended that much to reach to the constrained positions. In this case such intervals can be filled using motion graphs, or filling this gaps by using blending methods. This work is extended to be used for variety of motions in [59]. In this algorithm all the motion is partitioned to smaller clips, each clip defines different type of motion such as walking (one clip), holding a box (one clip), carrying the box (one clip). In this way this method becomes very general and user selects the clips he wants to change. Still foot skating and unreachable leg extensions have to be handled. Figure 2.23: The top shows the original motion of a character which is picking up a box and carrying it. The lower one shows the motion after user manipulated the walking path. Note that rectangles are defining the inflexible regions (tiles) which are connecting the Bèzier splines (flexible regions) [59]. Before closing the chapter we have to denote that quality of the re-used motions depend on physical correctness. Safonova aabd Hodgins ([60]) made a survey on physical correctness of interpolated human motions. They considered 1) linear and angular momentum during transition, 2) foot contact, static balance and friction with the ground during stance and 3) continuity of position and velocity between phases. Since blending
48 Figure 4.1: Example of an right foot plant interval: right-heel strike (first), right toestrike (second), right heel-off (third), right toe-off (fourth) 4.1.1 Using Displacements and Velocities When feet are planted they are supposed to be stationary and contact with floor. But because of the sensor noise or calibration errors during capturing the motion there can be small movements in the plant time interval. So for this reason, most of the time heel and toe displacement won’t be zero. For detecting these intervals we put a threshold for the vertical displacements of the heel and toe, and another threshold velocity for foot joints. Inputs: vert dVertical displacements of each joint (left heel, left toe, right heel, and right toe) vVelocities of the joints at each frame threshold v Velocity threshold for each joint search w Search window size for detecting the noise. Step 1: Compute absolute joint displacements and joint velocities for each frame. Step 2: Evaluate joints considering only vertical displacement and joint velocities. Step 3: Check the noise intervals using a fixed size window. Step 4: Eliminate the foot strike intervals which are totally inside of the other one.
49 First and the second steps are straight forward to compute. When these steps are completed we will have two evaluation tables: one for the vertical displacement and one for velocities of the feet’s joints. These tables consist of four columns: left heel, left toe, right heel, and right toe columns as shown in the figure 3.2. In second step for each frame we compare the each joint’s vertical displacement and velocities with the given threshold and the result is saved into one of these tables. Table 4.1: Threshold Evaluation Table Structure Frame Left Heel Left Toe Right Heel Right Toe 1 True False False False 2 True True False False …. … … … … 355 False False True True After having these tables we check each row for possible noises as shown in figure 3.2 (step 3). For this step we use different sizes of windows. We observe that a 30 frame size window is giving good results. We put this window to a seed key frame (each of the non-stance key frames). The percentage of marked frames (stance) around this seed frame is computed. If the result is lower than thirty percent then it is accepted as non stance key frame for that joint. But if it is higher, un-marked key frames between the marked ones are made marked. Row Heel Stance (Noisy Data) Noise Artifacts
50 Detecting Noise Artifacts (Detecting and fixing noise intervals with a window) min w i max w Noise Free (Fixed Data) Figure 4.2: Steps of detecting and removing noise from data If we check an example normal real walking data as depicted in figure 2.5 we will realize that left foot and right foot stance intervals are crossing each other. But by using the method which is told so far we can find some intervals which are small compare to the other stance interval which is including it/them. This kind of events cannot occur in a normal walking/running cycle. To avoid this problem we compare the intervals which are computed up to the last step. Another possible result that we can have: small consecutive stance intervals having small gaps between each other and not overlapping with other foot stance intervals. These gaps can occur because of the threshold we used is not valid for each of the stance intervals or motion can be very noisy (Figure 3.4). Left Foot Stance Interval Right Foot Stance Interval Left Foot Stance
51 Cleaned Right Foot Stance Intervals Cleaned Right Foot Stance intervals wrt left foot Figure 4.3: Process of Step 4 Stance intervals of left foot and right foot. Red = stance, White = no stance. Stance intervals merged for right foot. Figure 4.4: Merging small stance intervals. With the brute force method (just using the vertical displacements in the above algorithm), for some of the motions we have good results but some kind of the motions this algorithm gives poor results. For instance we tried a normal cyclic walking data which is taken from Carnegie Mellon University’s database with 07_01.amc name. This motion has 315 key frames in total. You can check the result of the algorithm for this data from the below Tables. Table 4.2: For 07_01.amc automatic foot plant intervals detection results (left) and manually checked results (right) Threshold 0.001 Window Size 21frames for heels, 11 frames for toes Left Heel Plants 61-110, 192-243 Left Toe Plants 71-135, 202-263 Right Heel Plants 2-46, 127-165, 257-310 Right Toe Plants 7-57, 138-189, 262-312 Left Heel 63-113, 197-243 Left Toe 71-138, 201-263 Right Heel 0-47, 131-167, 259-310 Right Toe 7-68, 136-195,265-315
52 Relaxed walking is another motion data which we downloaded from same database. It was under the Stylized Walk subject. This motion has more than 2500 frames. We partitioned it to small portions since it is very big and we just need a small portion of it for blending and other processing methods. So our small relax walking portion is called relaxed_01.amc in our dataset. It has 670 key frames in total. Table 4.3: Automatic foot plant intervals detection for relaxed_01.amc (left) and manual detection (right) Threshold 0.001 Window Size 21 for heels, 11 for toes Left Heel Plants 129-177, 313-354, 484-558 Left Toe Plant 134-203, 317-397, 498-567 Right Heel Plant 3-98, 201-286, 385-466, 563-661 Right Toe Plant 20-108, 229-305, 413-485, 592-669 From Carnegie Mellon University’s database under the same section we imported marching walking motion. We partitioned it in to small sections. We saved them in our dataset as: marching_01.amc and marching_02.amc. We tried the first one with the using the above algorithm by checking vertical displacements. Table 4.4: Automatic foot plant detection for marchin_01.amc (left) and manual detection (right) Left Heel 102-176, 293- 369, 473-546 Left Toe 1-21, 113-215, 313-397, 485-580 Right Heel 0-97, 206-276, 385-464, 566-645 Right Toe 23-118, 215-310, 394-487, 585-670 Threshold 0.0155 Window Size 21 for heels, 11 for toes Left Heel Plants 48-57, 149-206, 250-259, 286 309, 352-361, 390-412 Left Toe Plant 183-207, 286-309, 400-412 Right Heel Plant 6-58, 107-155, 209-256, 310-357 Right Toe Plant 8-57, 108-156, 209-256 Left Heel 52-87, 156-176, 258- 276, 360-410 Left Toe 1-7, 50-103, 153-204, 254-302, 355-413 Right Heel 6-40, 107-135, 207-226, 306-331 Right Toe 0-54, 102-154, 204-255, 303-356
53 As it can be figured out from the results in the last table, sometimes just checking the vertical displacement is not enough. This marching animation is a bit complicated since toe strikes occur before heel strikes. And in this data there are some problems about left foot displacement. If we check the table we can realize that right foot stance intervals are quite successful compared to the left foot. In general, for most of the motions 0.001 is enough for detecting these intervals considering noise effect. But for marching animation this threshold should be updated up to 0.0155 to get a relevant result. On the other hand if we add the velocity condition into step 2 the result will be much more different. If one foot is stationary and the other one is moving, it does not matter that if the planted one has a noise and moves a bit during planted interval. As expected the other leg should have a bigger velocity. So if we take into account the velocity factor the result for marching animation becomes like: Table 4.5: After applying velocity cooperation to joints As it can be observed from the above table results are quite better but still there are some problems due to noise. Velocity check step compares the magnitude of joint’s velocity with the other joints: for instance if left heel velocity is slower than the right heel and the right toe, then left heel is probably in a stance phase. But left foot can be in stance phase because of left toe, on the other hand left heel can be off. For this reason we can use threshold to partition a foot stance interval to heel stance and toe stances. Still using more constraints can give poor results since this method is based on using a threshold for vertical displacement and instantaneous velocities of joints. These values are usually noisy. Threshold 0.001 Window Size 21 for heels, 11 for toes Left Heel Plants 52-108, 156-209, 256-300 , 389-412 Left Toe Plant 82-108, 181-206, 285-311, 389-412 Right Heel Plant 7-46, 107-148, 209-249, 310-350, 412-412 Right Toe Plant 9-52, 108-155, 209-254, 412-412
54 4.1.1 Using Knee Rotation Angles For a cyclic motion we realized that it is possible to use knee movement to predict foot stances. In asf/amc file format (as it is in real life) knee has only one DOF which is rotating around “x” axis. For instance in a normal cycle at the time when left leg stretches most, right heel strikes to the ground and after a short while right toe stance occurs. In addition when left knee has the maximum “x” axis rotation value, both of left foot joints are in stance phase. It will be the same for the left leg: when left knee has the minimum “x” axis rotation value, right foot enters the right heel stance phase. And a few frames before this left heel off event occurs. Following the right heel stance, a few frames later right toe stance and left toe off will occur. And when left knee comes to its maximum rotation value both of the joints in right foot are supposed to be planted. The maximum rotation degrees can be used to predict the middle of the stance interval. Left Knee Right Knee Figure 4.5: Knee rotation values in X axis for marching_01.amc motion
55 As it can be seen from figure 4.5, detecting the foot stance intervals is very simple. But still marching motion is a bit complicated as stated in the previous section that toe strikes occur before heel strikes. We believe that when we are blending motions or fixing the foot skating artifacts with IK algorithms [30] replacing toe strikes with heel strikes (if they come true before heel strikes) will not create remarkable artifacts. Since we believe that heels are already in contact with the ground but they are a bit higher, this artifact is negligible compare to foot skating problem. More over in the FootSkate Solver [30], if the end effector cannot reach a point limbs are extended up to %3 of their initial lengths. Length change in human limb is undetectable even for observers [61]. But for the most of the motion types curves of knees do not have perfect shape as figure 3.5. Left Knee Right Knee Figure 4.6: Knee X Axis rotation degrees for drunk_01.amc with 584 frames.
56 From figure 4.6 we can see that detecting maximum picks is straight forward but it is not that much easy for minimums (maximum stretch of leg) since between two picks there can be several local minimums. For detecting the maximums we put a window let’s say with a size of l, l/2 key frames on the left and right checked for proving if our seed is the local maximum or not. If it is not, for the next iteration we continue from the biggest value key frame which is on the right of our seed. If it is we save it to the maximum candidate list. For detecting local minimums the method is similar: we put a fixed size of window and checking the values on the left and right of the window center. When a local minimum is detected then this key frame is saved in to the mini-mum candidate list. After this step we match each maximum candidate with a minimum candidate based on the idea a local maximum has to follow a local minimum. Following this a new list is created which holds local minimum and maximum pairs. A threshold (taking the mean of the differences) is applied to this list and the pairs which have lower difference values are removed from the list. In addition to this, more constraints have to be added into the candidate elimination step for the case of having a data like marching_01.amc. In this motion (figure 3.5) all the maximums and minimums are what we are looking for. So mean value of local maximums will be very high and most of our picks will be removed. Because of this case, we used the simplest way by putting a threshold such as 15 degrees between maximum pick pair and mean value. If the difference between maximum and mean value is lower than 15 degrees, candidates which are lower up to 30 degrees from maximum one are selected. But this can give poor results for the motions which are including several types of walking (marching and elderly). But since we are just using one type it is successful enough. For this kind of motions pairs can be grouped and the order of the local maximums and minimums can be considered for the solution. Figure 4.7: Finding local min-max by a window centered at a key frame, drunk_01.amc
57 We realized that first applying Fast Fourier Transform to the knee joints and removing high frequency signals will increase the correctness of above algorithm. Figure 4.8: Right Knee rotation of drunk_01.amc after removing small frequencies As it can be seen from figure 3.7 there were some small cavities around frames 350 and 400. After applying fft we removed small frequencies. We put a %10 threshold for removing high frequencies. This threshold compares the magnitude ratios on the frequency spectrum. As it can be seen from the figure 3.8 we have less noise and a better configuration. Since we have a user scripting interface we tried to give example sets to the system for predicting the stances. And considering this intervals system tries to predict a threshold for vertical displacement. But the results are not much better than what we got from automatic prediction algorithm which is told in the first section. >left_stances/right_stances motion_name strike_key_frames eg: left_stance drunk_01.amc 0 8 15 25 50 52 110 115 120 130 160… Using the scripting interface it is possible to correct automatic foot plant detection results such as: >left_heel_strikes motion_name intervals Eg:>left_heel_strike drunk_01.amc 0 52 110 160 222 270 >left_toe_strikes … >right_heel_strike … >right_toe_strikes …
64 All body partition keywords are given in page 54 which are: LOWER, UPPER, LEFT_LEG, RIGHT_LEG, LEFT_ARM, RIGHT_ARM, SPINE, HEAD. 4.3 Motion Path Editing Given the path of an initial motion it can be associated with a curve which is the smoothed version of the original path [58]. This curve can be altered to make the motion following the new one. To define this curve we used Bézier curves. In cubic Bèzier curves four points are used, .,,, 3210 PPPP Curve starts at 0 Pgoing toward 1 Pand arrives at 3 Pcoming from 2 P. Usually, it is not passing through 1 Por 2 P; these points are only there to provide directional information. The distance between 0 P and determines “how long” the curve moves into the direction 2 Pbefore turning towards 3 P. The parametric form of the curve is: ,)1(3)1(3)1()( 3 3 2 2 1 2 0 3PtPtttPtPttB +−+−+−= [ ] 1,0∈t Using Bezier cubic Bezier curves have some disadvantages. Trying to represent all of motion path by a single cubic spline will cause loss of detail and control. On the other hand if we use more than one cubic spline to have more control on path adjusting we will have 1 Cdiscontinuity problem between the consecutive curves at the points they connect to each other. For this reason Hermite Curves can be used. But in this type the splines curve is passing through all the control points which won’t be smooth [10]. To have a smooth curve we selected generalized Bèzier curves. Given points n PPP ..., 10 the Bezier curve is defined as: ( ) ∑ = − − = n i i i in Ptt i n tB 0 1)( = ( ) ( ) ( ) n n n n nn PtPtt n n tPt n Pt +− − ++− +− − − − 1 1 1 1 01 1 ......1 1 1 , [ ] 1,0∈t, where i n is the binomial coefficient. To define this curve we select each 15th key frame as a control point. If our first frame is k ( 0 P ) and last one is k+r ( n P ), we have to compute )(tB for every key frames in this interval. After this step we will have the corresponding 3D coordinate of the path per each key-frame. Following this, to manipulate the path of the motion we implanted Hermite curve on the motion path, and for every 400 frames we put five control points.
65 When the user changes one of the control points, motion path is updated. And we compare each point on the motion path considering transformations in X and Z axis. The displacements in X and Z axis are added to the root positions for the corresponding keyframe. To find the rotation around vertical axis (Y) we used a similar method as in the previous section. For each key-frame we compute two local frames using vertical axis (0, 1, 0) and tangent vectors for the key-frame on previous path and updated path. Cross product of the vertical axis and tangent vectors will give the Z axes in two local frames. X axes can be found by cross product of Z and Y axes. Using these axes we can construct the global rotation matrix for these two different reference frames. To find rotation around Y axis: 2 1 1rot2yrot1 MMMMMM − =⇒=y__ is computed, where 1 Mand 2 Mare global rotation matrixes and yrot M_ has component of Y axis rotation. Figure 4.16: Changing motion path with Hermite splines
66 Figure 4.17:First raw depicts the skateboard duck under motion for initial frame and for frame 235. On the second raw motion path altered using the control points (colored ones). Figure 4.18: Changing the path of normal walk motion (first raw), Right foot stance (second raw). Red line shows the right heel strike position. Right foot is put inside a yellow circle. In the above figure we have the result of altered path for the normal walk motion. Between key-frames 324 and 384 right foot plant occurs. In the initial motion there is no foot sliding artifact in this interval. Since there is a distance change between two consecutive control points it causes foot-skating artifact. For this reason we tried to use a library, FootSkate Solver[30], to get rid of this problem when a walking motion’s path is edited. To use this library the foot-plant intervals for the initial motion have to be known. In our framework this intervals can be entered manually via command window or there is an automatic check for each imported motion. In this library eight constraints can be defined, one for each heel, for toes, for wrists and for fingertips.
67 Figure 4.19: Skeleton Model for End Effector Cleanup [30] As in the figure 3.19 the hierarchy of the skeleton in Foot Skate solver has more DOF for wrist and ankle joints compare to the skeleton of the asf/amc motion capture data. As it can be seen from the last figure this library is just trying to correct the lower movements of arms and legs. So we can’t put any constraints to the spine and head. In our case we are using it to correct the lower body motion problems, so we do not need to put any constraints to the arms. When a motion is imported into our framework initially all the global rotation and global position of the joints are computed. And after any processing on the animation with path editing or motion blending methods these information is recomputed again. When there is a need to use this library this information is directly copied to FootSkate solver. The root orientation is not changed. Foot-Skate solver chops the constrained joints and puts them to the constrained position. After placing the constraint joints it fixes the root position using the length information of legs that they can reach. The position of the root is computed using spheres. More generally for every key-frame if n end effectors are constrained, then root has to be within the intersection of these spheres. If this is not true, then root must be projected onto the surface of the intersection region. Since we have constraints for left foot and right foot it will solve root placement problem using two spheres.
68 Figure 4.20: A constraint on a foot will make the root the projection closer to t1, if the other foot is only constrained one root’s projection will be closer to t2. On the other hand if both of them are constraint root projection will be at t3 [30]. Since the root position is computed for each key-frame it will have some visual artifacts for this reason a Gaussian smooth applied to the result. After having the position of the root and position of the constraint legs it fixes the tibia and femur. We can imagine that there is a circle which diameter is fixed between the constraint joint and hip. We can find the orientation of this circle from the constraint joint. When we have the orientation we can find the knee rotation from cosine law. Figure 4.21: Straight running animation before path editing (left) and after path editing (right) To use the path editing the following command can be used: To compute the path of the animation: >root_path motion_name eg: root_path run.amc To display the path of an animation if it is already computed: >display_root_path motion_name To set the constrained joints manually: >left_heel_strikes/left_toe_strikes/right_heel_strikes/right_toe_strikes motion_name intervals eg: left_heel_strikes run.amc 0 30 105 135…
69 4.4 Motion Editing with Signal Processing Methods The first technique that we use to process the motion is fast fourier analysis method. Details of the implementation of FFT algorithm can be checked from [42]. The idea for using the fft was for detecting the period of a cyclic motion as it has been told in [27]. Fundamental frequency is the one which is the biggest in amplitude in the frequency spectrum. After detecting the fundamental frequency we can put a threshold to remove the frequencies which are low compared to fundamental frequency. In this way we can have smooth motion signal for a character with fewer local maximums and minimums motion signal for each joint. Then motion signal for some key joints can be exported for some tools which are imitating key poses such as Simbicon and Dance. In our framework we used fft to change the joints motion individually or to lower or exaggerate all body motion. After a motion is imported into our framework user can select to compute fft of all the body motion and then each DOF of joints can be manipulated from joints window. Or a threshold can be put into all DOF of joints from motion window. But any change to the lower body and root joint can result in visual artifacts. Since humanoid characters are represented as a hierarchy any change in the upper part of the hierarchy can cause abrupt motions in the lower parts. In this sense it is very difficult to reproduce a new motion by manipulating the signals of lower body that we have to find a good synchronization between the translation and rotation of root joint and legs’ joints rotations by playing signals. Unsynchronized root translation and joint rotations will cause foot-skating problems. In addition to these fft can be used for smoothing the motion, spatially for the joints which have some noise at some keyframes. Figure 4.22: X axis rotation of foot joint in a normal walk animation taken from a motion of CMU motion database.
70 Above figure depicts to X axis rotation of a joint in a normal walk. There are some noise data which can be realized from the graph. But most of these abnormal movements are not realizable when we play with the motion. But on the above figure around key-frame 25 there is an odd change and it is obvious when we watch the character movement in real time. Figure 4.23: X axis rotation of the root joint after smoothing the signal. We removed all the signals from the initial one which are smaller than %10 of the original motion’s fundamental frequency in magnitude. After smoothing the signal as in the last figure the vertical distance between the local maximums and local minimums decreases. For instance in our example this will cause to foot to rotate less in the x axis. To fix the rotation to previous range remaining frequencies in the spectrum can be multiplied with a constant. Figure 4.24: After multiplying all the frequencies in the new signal with 1.25. Local max and local min are closer to the original motion.
71 In addition to removing noise from the joints using fft we have also tried to change the motion by multiplying each joint DOF by a constant. This constant has to be same for every DOF. After this some joints have to be corrected. For instance when the root’s transformation signals are multiplied, character will appear in a different vertical coordinate. Furthermore changes in the character root orientation will rotate and make the legs collide with each other when the one foot is moving and other one is planted. Figure 4.25: First three frames are the 1st key-frame of the initial walking animation. Second frames screenshots are the 1st key-frame from front, left and right when the initial motion signals are multiplied with 1.5. As it can be seen from the above figures femurs and shoulders of the character are rotated so much that during the animation limbs will pass through each other. For this reason when the motion weight is changed we correct the rotation values of femurs and shoulders. In general asf/amc file has a constraint for the rotation limits for each DOF. For instance from the observations of biomedical knee rotation limits is [-10, 170] and it has only one DOF. But after multiplying the knee X axis with different weights we can have new values that can be out of these limits. This is very disturbing when it occurs in elbows and knees. For this reason after each manipulation in the motion for each keyframe X axis rotations are checked to see if the limits are violated. When this case occurs then they are fixed to the limit angles for the corresponding key-frames.
72 Figure 4.26: After the femur and shoulder joints are corrected. Other method to enrich the humanoid motions as in [53] is using multi-resolution filtering. In the first step image lowpass pyramid is obtained by convolving the image with a B-Spline filter kernel and at each level this image is sub-sampled by a factor of two as in the below figure. Let’s the original image be 0 Gand to final image be n G. You can see the lowpass pyramid in the below figure. This processing is repeated until the image size is reduced to one pixel, which has the average intensity. Then we compute the band-pass pyramid by taking the difference of two successive Gaussian pyramid images. Let’s call these images 1n L−…0 L. Then the original image can be constructed by: 0 G= 0 L+ 1 L+ … + 1n L−+n G. This is applied in [53] to the articulated motions. Here DOF treated as a one-dimensional signal from which lowpass (G) and band-pass (L) levels are computed. Let’s say we have m frames then we should have n ( 1 22 + ≤≤ nn m). Figure 4.27: Low pass pyramid (left), band pass pyramid (right)
73 Instead of constructing a pyramid of low-pass and band-pass sequences where each successive is reduced by a factor of two, alternatively the sequences are kept the same length and the filter kernel ( ω ) is expanded at each level by inserting zeros between the value of the filter kernel (a, b and c). For instance with the kernel of width 5, [ ] cbabc ,,,,= 1 ω [ ] cbabc ,0,,0,,0,,0,= 2 ω [ ] cbabc ,0,0,0,,0,0,0,,0,0,0,,0,0,0,= 3 ω , where a=3/8, b=1/4, c=1/16. Computing motion multi-resolution has five steps: 1. Compute low pass sequences considering n: kkk GG ×= ++ 11 ω 2. Compute the band-passes: 1− −= kkk GGL 3. Adjust the gains for each band ( k L). 4. Reconstruct the motion signal. ∑ − = += 1 0 0 n k kn LGG After computing these bands we put sliders into the user interface to change the gains and for producing a different motion. According to our results it produces good motion for the upper body, but for the lower body spatially if there is a change in the femurs or root joint visual artifacts appears. This is mostly due to synchronization problems of the legs and the time when feet hit to the ground. In this phase Foot Skate solver can be used. Figure 4.27: Rotation around Y axis of lower back joint in a normal walk.
80 that this method can be used to remove the noise in the motion which is realizable during the animation. Second method implemented by using multi-resolution technique that it created bands for each DOF. User can play with these bands and change the behavior of the joints. Higher bands represent the course grain motion signal. On the other hand these two methods suffer having a lot of parameters. This study can be regarded as a preliminary work for motion processing. A number of practical issues, that are widely discussed in this thesis, need to be addressed in future work. An important one is the following: When a motion is modified with path editing method and if the arc lengths between the control points extended too much, inverse kinematics cannot give a solution to extend the legs to preserve the continuity. For this scenario motion graphs can be used as a solution.
81 CHAPTER VI FUTURE DIRECTIONS This thesis involves an overview of advantages and disadvantages of different methods for motion capture data processing. Beyond the analysis of existing algorithms, it proposes how to combine the good features of them to create a new motion from a single data or different motions by blending. Also it addresses a solution for estimating foot plants. Considering our main results, this study will provide a background for a number of future directions. Motions can be merged by improving our blending method. Since we know the intervals of the foot plants we can extend our implementation for detecting a good interval for transition from one motion to another. This can be done in a brute force way only considering the first motion foot stance at the end of the motion and the beginning foot stance in the second motion. But we think that this can produce some abrupt results. In this sense we need to use motion graph algorithms to find a good transition interval. We already tried to construct motion graphs but it is very slow if it is computed on CPU. Because of this we already started to extend our work by computing motion graphs on GPU. There are many implementation issues that need to be addressed to have fast and robust algorithms to enrich the character animations. The methods implemented in chapter III and chapter IV can be seen as a starting work. As it is discussed so far in this thesis we studied motion enriching problem. We believe that having motion graphs as future work will give more chance to enrich the humanoid motions.
82 REFERENCES [1] “The Complete History of the Discovery of Cinematography”, http://www.precinemahistory.net/introduction.htm [2] R. Balzer, Optical Amusements: Magic Lanterns and Other Transforming Images, A Catalog of Popular Entirtainments, Richard Balzer, 1987 [3] http://en.wikipedia.org/wiki/Kinetoscope [4] http://en.wikipedia.org/wiki/Georges_Mèliès, http://www.videosurf.com/video/atrip-to-the-moon-part-1-1218239?vlt=ffext [5] http://en.wikipedia.org/wiki/J._Stuart_Blackton, http://www.videosurf.com/video/humorous-phases-of-funny-faces-9331028?vlt=ffext [6] http://en.wikipedia.org/wiki/Felix_the_Cat [7] http://en.wikipedia.org/wiki/Walt_Disney [8] http://www.pixar.com/shorts/tt/index.html [9]S. Roberts, Character Animation in 3D, Focal Press (2004). [10] R. Parent, Computer Animation: algorithms and Techniques, 2nd edition, Morgan Kaufmann (2008). [11] Florian Struck, et al, Realistic Shading of Human Skin in Real Time, Proceedings of the 3rd international conference on Computer graphics, virtual reality, visualization and interaction in Africa, 2004, pp. 93-97. [12] L. Kavan, et al, Duel Quaternion for Rigid Transformation Blending, Proceedings of the 2007 symposium on Interactive 3D graphics and games, 2007, pp. 39-46. [13] Soha Moad, Saida Bouakaz. Geometric Modeling of Moving Virtual Humans: A Survey of Various Practices, Journées GTMG - Groupe de Travail en Modélisation Géométrique, 2004. [14] Autodesk Maya, http://usa.autodesk.com/adsk/servlet/pc/index?siteID=123112&id=13577897 [15] Autodesk 3ds Max, http://www.autodesk.it/adsk/servlet/pc/index?siteID=457036&id=14642335 [16] Blender, www.blender.org [17] Animeeple, http://www.animeeple.com [18] Endorphin, www.naturalmotion.com/endorphin.htm [19] Dynamic Animation and Control Environment, http://www.arishapiro.com/dance/
83 [20] Alexander Kort, “Computer Aided Inbetweening”, In NPAR’02: Proceedings of the 2nd International symposium on Non-photo realistic animation and rendering, pages125–132. New York, NY, USA, 2002. ACM Press. [21] Real-time 3D Character Animation with Visual C++, Focal Press (2001). [22] Understanding Motion Capture for Computer Animation and Video Games, Morgan Kaufmann, New York, 2000. [23] L. Unzueta, M. Peinado, R. Boulic, Á. Suescun, Full-body performance animation with Sequential Inverse Kinematics, Graphical Models. September 2008, pp. 87-104. [24] Adam G. Kirk and O. Arikan, Real-Time Ambient Occlusion for Dynamic Character Skins, ACM SIGGRAPH Symposium, April 2007. [25] “Cinema: 100 Years of the Moving Image” http://www.angelfire.com/vt/mhunt/cinema.html, 2000 [26] Granata, K.P., Brogan D.C., Sheth P.N., Stable Forward Dynamic Simulation of Bipedal Gait Using Space Time Analysis, In American Society of Biomechanics Proceedings of IV World Congress of Biomechanics, 2002. [27] Kang Kang Yin, Kevin Loken, and Michiel van de Panne, SIMBICON: Simple Biped Locomotion Control, ACM Transactions on Graphics, 2007, Article No.: 105. [28] M. McKenna and D. Zaltzer, Dynamic Simulation of Autonomous Legged Locomotion, Proceedings of the 17th annual conference on Computer graphics and interactive techniques, 1990, pp. 29-38. [29] Ari Shapiro, Derek Chu, Petros Faloutsos, The Dynamic Controller Toolkit, Proceedings of the 2007 ACM SIGGRAPH symposium on Video games, pp. 15-20. [30] L. Kovar, J. Schreiner M. Gleicher. Footskate Cleanup for Motion Capture Editing, Proceedings of the 2002 ACM SIGGRAPH/Eurographics symposium on Computer animation (SCA). July 2002, pp. 97-104. [31] Samuel R. Buss, Introduction to Inverse Kinematics with Jacobian Transpose, Pseudoinverse and Damped Least Squares methods, Unpublished study, http://math.ucsd.edu/~sbuss/ResearchWeb/ikmethods/index.html [32] R. Boulic, B. Ulicny, D. Thalmann, Versatile Walk Engine, Journal of Game Development, 1(1), pp 29-52, Michael van Lent Editor, Charles River Media. www.jogd.com, 2004. [33] Inman VT, Ralston HJ, Todd F, Human Walking, Baltimore, Williams & Wilkins, 1981.
84 [34] Samuel R. Buss, Jin-su Kim, Selectively Damped Least Square for Inverse Kinematics, In Journal of Graphics Tools, vol. 10, no. 3 (2005), pp. 37-49. [35] Jean-Sébastien Monzani, Angela Caicedo and Daniel Thalmann, Integrating Behavioural Animation Techniques, EUROGRAPHICS 2001, Volume 20, Number 3. [36] T. Conde, W. Tambellini, and D.Thalmann, Behavioral Animation of Autonomous Virtual AgentsHelped by Reinforcement Learning, Lecture Notes in Computer Science, vol. 272, pp. 175-180, Springer-Verlag: Berlin, 2003. [37] Acclaim ASF/AMC, http://www.cs.wisc.edu/graphics/Courses/cs-838- 1999/Jeff/ASF-AMC.html [38] Euler Angles, http://en.wikipedia.org/wiki/Euler_angles [39] E .B. Dam, M. Koch, M. Lillholm, Quaternions, Interpolation and Animation, Technical Report DIKU-TR-98. [40]Maths - Conversion Quaternion to Euler, http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEu ler/index.htm [41] Gregory G.Slabaugh, Computing Euler Angles from a Rotation Matrix, Unpublished Report, 1999 [42] Numerical Receipts in C, Second Edition, Cambridge University Press 1992. [43] David Gerhard, Pitch Extraction and Fundamental Frequency: History and Current Techniques, Technical Report TR-CS 2003-06, November 2003 [44] P. Mcleod, G. Wyvill, A SmarterWay to Find Pitch, in Proceedings of International Computer Music Conference, ICMC, 2005 [45] Anssi Klapuri, Signal Processing Methods for the Automatic Transcription of Music, PHD thesis submitted to Tampere University of Technology, 2004. [46] L.Ikemoto, O.Arikan D.Forsyth, Knowing when to Put Your Foot Down, Proceedings of the 2006 Symposium on Interactive 3D Graphics and Games, . [47] P.Glardon, R. Boulic, D. Thalmann, Robust On-lin Adaptive Footplant Detection and Enforcement for Locomotion, The Visual Computer: International Journal of Computer Graphics, Volume 22, 2005, pp. 194-209. [48] Peter Bodik, AutomaticFootplant Detection Inside FlMoView, A summer project for Michael Gleicher, June -- August 2000. [49] L. Kovar, M. Gleicher, F. Pighin, Motion Graphs, ACM Transactions on Graphics, 2002, Volume 21, Issue 3, pp. 473 – 482.
85 [50] J. Lee, J. Chai, P.S.A. Reitsma, Interactive Control of Avatars Animated with Human Motion Data, ACM Transactions on Graphics, 2002, pp. 491–500. [51]Wan-Yen Lo, M. Zwicker, Bidirectional Search for Interactive Motion Synthesis,Eurographics, Computer Graphics Forum, 2010, pp. Volume 29, Issue 2, pp. 563-573. [52] C. Fraley A. E. Raftery, How many Clusters? Which Clustering Method? Answers via Model-Based Cluster Analysis?, Computer Journal41, Volume 41, No: 8, 1998, pp. 578-588. [53]A. Bruderlin, L. Williams, Motion Signal Processing, In Proceedings of ACM SIGGRAPH 95, Annual Conference Series, pages 97-104. ACM SIGGRAPH, August1995. [54] T. Shederberg and E. Greenwood, A Physical-based Approach to 2D Shape Blending, Proceedings of the 19th Annual Conference on Computer Graphics and Interactive Techniques of SIGGRAPH, 1992, pp. 25-34. [55] R. Demori, D. Probst, Handbook of Pattern Recognition and Image Processing, Academic Press, 1986, ch. Computer Recognition of Speech. [56] P. Glardon, R. Boulic, D. Thalmann, On-line Adapted Transition between Locomotion and Jump, Proceedings of the Computer Graphics International, 2005, pp.44-50. [57] P. Glardon, R. Boulic, D. Thalmann, A Coherent Locomotion Engine Extrapolating beyond Experimental Data, In: Proceedings of Computer Animation and Social Agent, pp. 73–83, Geneva (2004). [58] M. Gleicher, Motion Path Editing, Proceedings of the 2001 Symposium on Interactive 3D Graphics, pp. 195-202. [59] S. Andrew, M. Gleicher, Motion Editing with Paths and Tiles, BS Honors Thesis, 2003. [60] A. Safonova, J.K. Hodgins, Analyzing the Physical Correctness of interpolated Human Motion, Proceedings of the 2005 ACM SIGGRAPH/Eurographics symposium on Computer animation, 2005, pp. 171-180. [61] J.Harrison, R.Rensink, and M.vandePanne. Obscuring Length Changes during Animated Motion. ACM Transactionson Graphics, 23(3): 569–573, 2004. [62] Gregory M. Nielson, v-Quaternion Splines for the Smooth Interpolation of Quaternions, IEEE Transactions on Visualization and Computer Graphics, Vol. 10, No.2, 2004
86 [63] http://en.wikipedia.org/wiki/Sagittal_plane