
Skeletal animation in games. Overview of Techniques and Resources
Anima is the soul that distinguishes the living from the dead. The Aristotelian soul is the principle of movement, manifested in four forms: movement, transformation, decrease and increase. After almost two and a half thousand years, we use the same categories in computer graphics. Skeletal animation defines movement, morphing is used for transformations, and decreasing and increasing is the usual scaling. Animated graphics enliven the image, breathe the soul into the picture, and this, in my opinion, is even more important than a reliable play of light and shadow.

Creating high-quality skeletal 3D animations today is perhaps the most difficult task for indie developers. This is probably why there are so few indie games in 3D, and so many projects in the styles of pixel art or primitivism, as well as wanderings without characters in the frame. But now this ratio may change ...
Try counting the number of different animations in Uncharted 4. According to my estimates, there are about an hour of unique movements, not counting facial animation ( 850 expressions according to the authors). Similar games set a fantastic level of quality.

While physical rendering and the creation of high-quality static scenes are made available to enthusiasts thanks to powerful free game engines and 3D modeling tools, creating good animation requires equipment for capturing movements and lengthy painstaking work to implement them. One of the most affordable systems is the neuronmocap suit , costing about $ 1.5k, excluding delivery.
I was not able to find examples of creating animation that was at least close in level using a manual personnel approach or any procedural animation. The maximum that can be done manually, in my opinion, is simple strokes, quick movements and stylized cartoon animation. But how to make realistic walking up the stairs, where there are a lot of details related to the portable center of gravity and body balance? You cannot play them all manually. Maybe I'm wrong, and someone will show the work of specialists of this level? ..
All this I recall in order to appreciate the generous gift from Mixamo . It literally opens the door to a new level for independent developers: Adobe boughtMixamo, and now they give away 2.5 thousand skeletal animations for characters completely free of charge " for unlimited commercial or non commercial use ":
www.mixamo.com
Half a year ago, you could get them only by laying out about $ 36,000 (well, or a network twist). In addition to animations, the company also offers a free version of the tool for rigging and skinning characters, a tool for creating multiple levels of detail with minimal loss of quality (LOD), a character generator and a plug-in for capturing facial animations.

There are no less elaborate sets of animations available for purchase by enthusiasts. But such a giant and high-quality set was first available for free. Another good source of clips is the Carnegie University's animation database - Mellon and its version adapted for Unity , but the quality and content of this database are not so good.
In addition to manual personnel animation and capture of the actor’s movement, there are also interesting procedural methods for simulating movements: evolutionary modeling , neural networks , task based locomotion. Interestingly, at the SIGGRAPH 2016 conference, these difficult techniques are paid a lot of attention. But these things are not yet available to a wide circle of independent developers, and I myself would like to know more about the possibility of their real application. However, today there are also available tools that simulate muscle dynamics ( Euphoria Engine and Puppet Master for Unity3d), which allow you to bring a variety of character reactions to circumstances.



Getting high-quality and varied animated clips is only the first part of the task.
The second part is to correctly use the resulting animations when controlling the character. To do this, you first need to decide how to generally shift the character in the scene: based on the data of the animation itself (1), or on the basis of some other considerations (for example, solid state physics) (2). That is, either the animation will be calculated based on the arbitrary (physical) movement of the object in space (2), or the displacement in space will come from the recorded animation, ignoring other interventions (1).
Both approaches have advantages and disadvantages. In the old days, before the mass use of motion capture, there was almost no question about it - the characters moved procedurally, based on some simple principles, and animated clips were simply played for some correspondence to this movement. But the better the animation and graphics in general became, the more noticeable was the discrepancy between the movement of the legs and the displacement of the character, as well as the lack of dynamics of the movement.
One of the vivid examples can be the game Guild Wars 2 where the animation of movements and graphics are already quite good, but the large range of possible speeds and directions of movement of the character is not provided with an equally large set of animations, and the characters either stall in place or slip forward like on ice . The same problem has long been plagued by games on the Gamebryo engine (TES series: Morrowind, Skyrim), and many others.
The real movement of a person is non-linear - first we lean forward, then throw out the leg, and only then we begin to move, quickly accelerating after the contact of the foot with the ground, and we move by inertia to the next step. It is difficult to choose a function that accurately describes such a movement, and rarely does anyone even think about it. What can we say about more complex movements - strafe, transitions between directions, braking and cornering.
Therefore, in order to achieve realism, in any case, we need a gigantic set of various clips with movements in different directions, at different speeds, etc. ... In addition, animation clips can rarely be used in isolation, playing one after the other. Most often, there are many animations in the game, between which there are no special animated transitions. Therefore, to simulate them, smooth mixing is used through linear interpolation of bone rotations. For convenient adjustment of such transitions, the so-called state machine or state machine. In UE and Unity, there are special tools for this: Persona and Mecanim. Each node there is a certain state of the skeletal model (a prepared animation clip or the result of their mixing - Blend Tree). When some given conditions are fulfilled, a smooth transition from one state to another takes place, during which both have a proportionate time effect on the rotation of the bones and the displacement of the object. Thus, the illusion of continuity of movement is achieved.
The state may not be a single clip, but a set of clips mixed according to the same principle (Blend Tree / Blend Space). For example, from the clips of the character’s movements to the sides, you can select several by mixing them in proportion to the vector of the desired movement, and get the movement at any arbitrary angle. However, there are such animations for which mixing turns into incorrect poses. For example, when one animation moves the character's legs forward and the other sideways, linear mixing can cause the legs to intersect with each other. To avoid this, you need to carefully select the animation clips, synchronize their phase, length and speed, or add a separate clip specifically for this type of movement. All this is difficult and painstaking work. And the more possible states and transitions between them, the more difficult it is to bring them into agreement with each other,

1) The most obvious solution is to capture the movements of a real actor using Motion Capture and link the character’s shift in the game to the “root bone” shift in the animation itself - the Root Motion principle. Then the character will move exactly as the actor moved during the recording.
It looks very realistic. Moreover, this is the only way to reliably reproduce complex maneuvers such as attacks, dodges and parry attacks with melee weapons.
But this approach also brings obvious problems.
Let's say the character wants to move to the edge of the cliff: the actor on the record bends down, raises his leg and takes a bold wide step across the stage. And the character steps right into the abyss ... To avoid this, you need to interrupt the step somewhere in the middle, but this not only looks unnatural, but also makes it difficult for the player to choose the right moment due to the non-linearity of the movement, which can be a long preparation (tilt), and then a sharp confident movement (step). You can record several motion options. Suppose: careful small steps, normal, and running. And then mix them according to the parameter of the required speed, which can be increased linearly and predictably. But what if we need side movements? So for each step width option we need three or four more options (minus mirrored ones). And the character must be able to turn while moving. So for each option, we need movement with a turn. And if the turn can be fast and slow? So once again we multiply the number of required clips by two. And now we need movement on an inclined surface! And then we want the character to be able to do the same thing in the squat. Total - just hundreds and thousands of animation options that need to be mixed and make sure that this happens correctly and leads to movements at the right speed. And still, in many cases the control will feel like “cotton”, since the inertia of the actor and our inability to foresee all possible human maneuvers will deprive the player of control over the character. This problem, by the way, was felt by the players in The Witcher 3, therefore, in one of the major updates, the developers introduced an alternative control option, where animation responds faster to control to the detriment of realism. In shooters, the problem of non-linearity of movement takes on a particularly pronounced character: the player often has to peek around the corner and quickly go back, and the moment of a sharp change of direction can be very different - the player needs to return back for cover as soon as possible, and we have no way to predict in advance what width step he planned and play the corresponding animation. The player, in turn, will find it difficult to get used to the width of the step that his character makes, and to the speed of this step in order to interrupt him in time. and the moment of a sharp change of direction can be very different - the player needs to return back for shelter as soon as possible, and we have no way to predict in advance what width the step was planned for and to play the corresponding animation. The player, in turn, will find it difficult to get used to the width of the step that his character makes, and to the speed of this step in order to interrupt him in time. and the moment of a sharp change of direction can be very different - the player needs to return back for shelter as soon as possible, and we have no way to predict in advance what width the step was planned for and to play the corresponding animation. The player, in turn, will find it difficult to get used to the width of the step that his character makes, and to the speed of this step in order to interrupt him in time.
Secondly, Root Motion is bad for network games. The non-linearity of the movement not only makes it difficult for the player to predict the speed, but also deprives us of the ability to interpolate and extrapolate the movement to compensate for network delay, which is a very important and difficult aspect in fast network games. If the character’s displacement is set only by animation, then it is difficult to analytically select the necessary parameters of the state machine (mixing different animations), which will lead to the character’s movement in the direction we need and at the speed we need (chosen to compensate for the discrepancy). If you do the opposite, so that the animation will focus on the actual movement, then when correcting the discrepancy between the server and the client, it will be easy to choose the most suitable animation,
Therefore, the Root Motion technique is often used in single-player games from a third party, where control is carried out contextually - depending on the presence of shelter, obstacles, traffic conditions or other circumstances, and is rarely used in network mode and MMOG.
Of the recent notable projects using Root Motion, The Witcher 3 can be distinguished . It is difficult to overestimate the efforts put into the production of all his movements.
2) Another solution is the opposite of the Root Motion principle - you need to bring the animation in the most exact correspondence with the occurring or planned movement. Then many of the problems described above are solved - the character’s movement can be made equally accelerated and predictable with the possibility of an arbitrarily fast change of direction. But how to bring non-linear and inertial animation in line with this movement? An interesting integrated approach was described by the developers of the game Paragon. Its essence is to find and play only the desired series of frames of the animation to achieve the required displacement / rotation, skipping the extra ones. And use inverse kinematics to modify the step width.
The first obvious difficulty in bringing the animation in line with the movement is that the movement has already occurred and the animation has not yet been played. Therefore, a motion prediction system that calculates the character’s position for the next frame is very useful. Then, knowing the offset that the character should make in the next frame, you need to skip as many frames of the motion animation clip as you need to achieve the desired offset, and play the frame at which the desired offset has been achieved. In this case, the animation will begin to play at a changed speed, so as to exactly match the actual displacement, and this speed can be faster or slower than the original, since it is impossible to force the real actor to maintain constant acceleration or speed. This approach will smooth the animation and bring it into line with any complex procedural model of movement that changes during the game (the character may drink some accelerating potion or be slowed down by the enemy). The disadvantage, of course, is that the animation may become less realistic due to strong changes in speed. However, in practice this gives a very good window of available variations in which speed disturbances are invisible. And coupled with step width corrections using inverse kinematics, it covers an even larger range. However, in practice this gives a very good window of available variations in which speed disturbances are invisible. And coupled with step width corrections using inverse kinematics, it covers an even larger range. However, in practice this gives a very good window of available variations in which speed disturbances are invisible. And coupled with step width corrections using inverse kinematics, it covers an even larger range.
But, unfortunately, this method pretty much violates the usual approach to animation, and therefore I could not find a simple way to implement it, for example, using the standard animation component Unity. The Unreal Engine also does not yet have the necessary functionality, but the developers promisesomeday transfer low-level developments made for Paragon to the public version of the engine. The main difficulty is the search and playback of the desired frame based on data on the actual displacement and rotation. To do this, the authors propose to pre-process the animation clips and generate an additional data block for each of them: Distance Curve, in which the values of the displacement and rotation of the root bone relative to the beginning or end of the animation will be saved frame-by-frame. Then, during the sampling, you can perform a quick binary search for the desired frame, where the corresponding offset and rotation parameters are achieved, and play it.
In the meantime, you can confine yourself to the previous approach, and make a less accurate adjustment of the animation speed to the speed of the planned movement, focusing only on the speed of the character for the last frame. Most importantly - a good set of souls for experiments is now available!

Creating high-quality skeletal 3D animations today is perhaps the most difficult task for indie developers. This is probably why there are so few indie games in 3D, and so many projects in the styles of pixel art or primitivism, as well as wanderings without characters in the frame. But now this ratio may change ...
Try counting the number of different animations in Uncharted 4. According to my estimates, there are about an hour of unique movements, not counting facial animation ( 850 expressions according to the authors). Similar games set a fantastic level of quality.

Uncharted 4 animation examples (> 40mb GIF)



While physical rendering and the creation of high-quality static scenes are made available to enthusiasts thanks to powerful free game engines and 3D modeling tools, creating good animation requires equipment for capturing movements and lengthy painstaking work to implement them. One of the most affordable systems is the neuronmocap suit , costing about $ 1.5k, excluding delivery.
I was not able to find examples of creating animation that was at least close in level using a manual personnel approach or any procedural animation. The maximum that can be done manually, in my opinion, is simple strokes, quick movements and stylized cartoon animation. But how to make realistic walking up the stairs, where there are a lot of details related to the portable center of gravity and body balance? You cannot play them all manually. Maybe I'm wrong, and someone will show the work of specialists of this level? ..
All this I recall in order to appreciate the generous gift from Mixamo . It literally opens the door to a new level for independent developers: Adobe boughtMixamo, and now they give away 2.5 thousand skeletal animations for characters completely free of charge " for unlimited commercial or non commercial use ":
www.mixamo.com
Half a year ago, you could get them only by laying out about $ 36,000 (well, or a network twist). In addition to animations, the company also offers a free version of the tool for rigging and skinning characters, a tool for creating multiple levels of detail with minimal loss of quality (LOD), a character generator and a plug-in for capturing facial animations.

There are no less elaborate sets of animations available for purchase by enthusiasts. But such a giant and high-quality set was first available for free. Another good source of clips is the Carnegie University's animation database - Mellon and its version adapted for Unity , but the quality and content of this database are not so good.
In addition to manual personnel animation and capture of the actor’s movement, there are also interesting procedural methods for simulating movements: evolutionary modeling , neural networks , task based locomotion. Interestingly, at the SIGGRAPH 2016 conference, these difficult techniques are paid a lot of attention. But these things are not yet available to a wide circle of independent developers, and I myself would like to know more about the possibility of their real application. However, today there are also available tools that simulate muscle dynamics ( Euphoria Engine and Puppet Master for Unity3d), which allow you to bring a variety of character reactions to circumstances.



Getting high-quality and varied animated clips is only the first part of the task.
The second part is to correctly use the resulting animations when controlling the character. To do this, you first need to decide how to generally shift the character in the scene: based on the data of the animation itself (1), or on the basis of some other considerations (for example, solid state physics) (2). That is, either the animation will be calculated based on the arbitrary (physical) movement of the object in space (2), or the displacement in space will come from the recorded animation, ignoring other interventions (1).
Both approaches have advantages and disadvantages. In the old days, before the mass use of motion capture, there was almost no question about it - the characters moved procedurally, based on some simple principles, and animated clips were simply played for some correspondence to this movement. But the better the animation and graphics in general became, the more noticeable was the discrepancy between the movement of the legs and the displacement of the character, as well as the lack of dynamics of the movement.
One of the vivid examples can be the game Guild Wars 2 where the animation of movements and graphics are already quite good, but the large range of possible speeds and directions of movement of the character is not provided with an equally large set of animations, and the characters either stall in place or slip forward like on ice . The same problem has long been plagued by games on the Gamebryo engine (TES series: Morrowind, Skyrim), and many others.
The real movement of a person is non-linear - first we lean forward, then throw out the leg, and only then we begin to move, quickly accelerating after the contact of the foot with the ground, and we move by inertia to the next step. It is difficult to choose a function that accurately describes such a movement, and rarely does anyone even think about it. What can we say about more complex movements - strafe, transitions between directions, braking and cornering.
Therefore, in order to achieve realism, in any case, we need a gigantic set of various clips with movements in different directions, at different speeds, etc. ... In addition, animation clips can rarely be used in isolation, playing one after the other. Most often, there are many animations in the game, between which there are no special animated transitions. Therefore, to simulate them, smooth mixing is used through linear interpolation of bone rotations. For convenient adjustment of such transitions, the so-called state machine or state machine. In UE and Unity, there are special tools for this: Persona and Mecanim. Each node there is a certain state of the skeletal model (a prepared animation clip or the result of their mixing - Blend Tree). When some given conditions are fulfilled, a smooth transition from one state to another takes place, during which both have a proportionate time effect on the rotation of the bones and the displacement of the object. Thus, the illusion of continuity of movement is achieved.
The state may not be a single clip, but a set of clips mixed according to the same principle (Blend Tree / Blend Space). For example, from the clips of the character’s movements to the sides, you can select several by mixing them in proportion to the vector of the desired movement, and get the movement at any arbitrary angle. However, there are such animations for which mixing turns into incorrect poses. For example, when one animation moves the character's legs forward and the other sideways, linear mixing can cause the legs to intersect with each other. To avoid this, you need to carefully select the animation clips, synchronize their phase, length and speed, or add a separate clip specifically for this type of movement. All this is difficult and painstaking work. And the more possible states and transitions between them, the more difficult it is to bring them into agreement with each other,

1) The most obvious solution is to capture the movements of a real actor using Motion Capture and link the character’s shift in the game to the “root bone” shift in the animation itself - the Root Motion principle. Then the character will move exactly as the actor moved during the recording.
It looks very realistic. Moreover, this is the only way to reliably reproduce complex maneuvers such as attacks, dodges and parry attacks with melee weapons.
But this approach also brings obvious problems.
Let's say the character wants to move to the edge of the cliff: the actor on the record bends down, raises his leg and takes a bold wide step across the stage. And the character steps right into the abyss ... To avoid this, you need to interrupt the step somewhere in the middle, but this not only looks unnatural, but also makes it difficult for the player to choose the right moment due to the non-linearity of the movement, which can be a long preparation (tilt), and then a sharp confident movement (step). You can record several motion options. Suppose: careful small steps, normal, and running. And then mix them according to the parameter of the required speed, which can be increased linearly and predictably. But what if we need side movements? So for each step width option we need three or four more options (minus mirrored ones). And the character must be able to turn while moving. So for each option, we need movement with a turn. And if the turn can be fast and slow? So once again we multiply the number of required clips by two. And now we need movement on an inclined surface! And then we want the character to be able to do the same thing in the squat. Total - just hundreds and thousands of animation options that need to be mixed and make sure that this happens correctly and leads to movements at the right speed. And still, in many cases the control will feel like “cotton”, since the inertia of the actor and our inability to foresee all possible human maneuvers will deprive the player of control over the character. This problem, by the way, was felt by the players in The Witcher 3, therefore, in one of the major updates, the developers introduced an alternative control option, where animation responds faster to control to the detriment of realism. In shooters, the problem of non-linearity of movement takes on a particularly pronounced character: the player often has to peek around the corner and quickly go back, and the moment of a sharp change of direction can be very different - the player needs to return back for cover as soon as possible, and we have no way to predict in advance what width step he planned and play the corresponding animation. The player, in turn, will find it difficult to get used to the width of the step that his character makes, and to the speed of this step in order to interrupt him in time. and the moment of a sharp change of direction can be very different - the player needs to return back for shelter as soon as possible, and we have no way to predict in advance what width the step was planned for and to play the corresponding animation. The player, in turn, will find it difficult to get used to the width of the step that his character makes, and to the speed of this step in order to interrupt him in time. and the moment of a sharp change of direction can be very different - the player needs to return back for shelter as soon as possible, and we have no way to predict in advance what width the step was planned for and to play the corresponding animation. The player, in turn, will find it difficult to get used to the width of the step that his character makes, and to the speed of this step in order to interrupt him in time.
Secondly, Root Motion is bad for network games. The non-linearity of the movement not only makes it difficult for the player to predict the speed, but also deprives us of the ability to interpolate and extrapolate the movement to compensate for network delay, which is a very important and difficult aspect in fast network games. If the character’s displacement is set only by animation, then it is difficult to analytically select the necessary parameters of the state machine (mixing different animations), which will lead to the character’s movement in the direction we need and at the speed we need (chosen to compensate for the discrepancy). If you do the opposite, so that the animation will focus on the actual movement, then when correcting the discrepancy between the server and the client, it will be easy to choose the most suitable animation,
Therefore, the Root Motion technique is often used in single-player games from a third party, where control is carried out contextually - depending on the presence of shelter, obstacles, traffic conditions or other circumstances, and is rarely used in network mode and MMOG.
Of the recent notable projects using Root Motion, The Witcher 3 can be distinguished . It is difficult to overestimate the efforts put into the production of all his movements.
An example of the animation of The Witcher 3 and its shooting



2) Another solution is the opposite of the Root Motion principle - you need to bring the animation in the most exact correspondence with the occurring or planned movement. Then many of the problems described above are solved - the character’s movement can be made equally accelerated and predictable with the possibility of an arbitrarily fast change of direction. But how to bring non-linear and inertial animation in line with this movement? An interesting integrated approach was described by the developers of the game Paragon. Its essence is to find and play only the desired series of frames of the animation to achieve the required displacement / rotation, skipping the extra ones. And use inverse kinematics to modify the step width.
The first obvious difficulty in bringing the animation in line with the movement is that the movement has already occurred and the animation has not yet been played. Therefore, a motion prediction system that calculates the character’s position for the next frame is very useful. Then, knowing the offset that the character should make in the next frame, you need to skip as many frames of the motion animation clip as you need to achieve the desired offset, and play the frame at which the desired offset has been achieved. In this case, the animation will begin to play at a changed speed, so as to exactly match the actual displacement, and this speed can be faster or slower than the original, since it is impossible to force the real actor to maintain constant acceleration or speed. This approach will smooth the animation and bring it into line with any complex procedural model of movement that changes during the game (the character may drink some accelerating potion or be slowed down by the enemy). The disadvantage, of course, is that the animation may become less realistic due to strong changes in speed. However, in practice this gives a very good window of available variations in which speed disturbances are invisible. And coupled with step width corrections using inverse kinematics, it covers an even larger range. However, in practice this gives a very good window of available variations in which speed disturbances are invisible. And coupled with step width corrections using inverse kinematics, it covers an even larger range. However, in practice this gives a very good window of available variations in which speed disturbances are invisible. And coupled with step width corrections using inverse kinematics, it covers an even larger range.
But, unfortunately, this method pretty much violates the usual approach to animation, and therefore I could not find a simple way to implement it, for example, using the standard animation component Unity. The Unreal Engine also does not yet have the necessary functionality, but the developers promisesomeday transfer low-level developments made for Paragon to the public version of the engine. The main difficulty is the search and playback of the desired frame based on data on the actual displacement and rotation. To do this, the authors propose to pre-process the animation clips and generate an additional data block for each of them: Distance Curve, in which the values of the displacement and rotation of the root bone relative to the beginning or end of the animation will be saved frame-by-frame. Then, during the sampling, you can perform a quick binary search for the desired frame, where the corresponding offset and rotation parameters are achieved, and play it.
In the meantime, you can confine yourself to the previous approach, and make a less accurate adjustment of the animation speed to the speed of the planned movement, focusing only on the speed of the character for the last frame. Most importantly - a good set of souls for experiments is now available!