Development Blog 3 - Procedural Animations and Inverse Kinematics
Procedural Animations
The next type of procedural generated content explored within this week's entry is procedural animation. The strength of procedural animation is that they can provide a programmatically based animation system without necessitating hand animation as would be traditional done by an animator. Of course, the goals and objectives of a given animation would be the deciding factor on the best outcome.
The goal of this week's entry is to look at application of procedural animation and how it could be applied to the development project.
Two main types of procedural animations are cited in much of the literature and applications; these being forward kinematics (FK) and inverse kinematics (IK).
Ruuskanen (2018, pp. 5 - 6) and Gazizov and Shubin (2024) provide a breakdown of these two methods for implementing procedural animation; FK is movement of the joints down the hierarchy of the limb structure starting from the top and rotating and transforming each joint to allow the end effector to reach its destination. 1 2
Conversely, IK starts with the goal position and rotation for the end effector to reach and subsequently calculates the rotation and transform needed for the joints going up the hierarchy during the movement of the end effector. 3 4
As a result of the real time calculations possible with IK during movement, it is best placed for consideration of implementation in the project where possible, if animations are to be within the project scope.
Practical Implementation of Inverse Kinematics
For the implementation of Inverse Kinematics (IK) in this project, the difficulty of producing a custom algorithm for implementing IK became apparent, and in the interest of time and project scope, a pre-built solution was sought. On the Unity Asset store, this author found a custom set of assets titled “Fast IK” (Daniel Erdmann, 2018) which provided scripts and in-engine demonstrations of IK to varying levels of complexity. 5
Furthermore, Erdmann provided video demonstrations for introducing users on how to use the scripts. 6
The algorithm that Erdmann implemented in the “Fast IK” unity asset is called the FABRIK algorithm from which video by EgoMoose (2016) provides explanation. 7
FABRIK stands for ‘Forward And Backward Reaching Inverse Kinematics’ and was developed by Aristidou, A. and Lasenby, J. (2011) as low computationally costing and realistic looking method for implementing IK. 8 *
*This author does wish to provide further information for self-reference / self-development on this topic, alongside signposting readers that are interested in reading further on this, to the website of the author Andreas Aristidou in which more detail and resources can be found on this topic that exceed the scope of this project. 9
Back to the topic practically implementing IK via Erdmann’s ‘Fast IK’ package, the asset package provided a C# script titled ‘Fast IK Fabric’, which is Erdmann’s implementation of the FABRIK algorithm. As seen in Figure 1, the number of joints of the limb to be animated is defined here, along with the transform position of the target for the limb to reach, with an optional pole transform position which influences the direction of the bending of joints in the limb.
Figure 1 – Image of the Unity Inspector for the script component Fast IK Fabric produced by Erdmann. 10
Figure 2 – Screenshot of Unity Project testing joint, highlighted in red the structure of the limb. 11
Figure 3 – GIF demonstration of Inverse Kinematics inactions using the Fast IK Fabric script. 12
In Figure 2 you can see the structure of the limbs from the main body transform component – each joint is a transform component acting as a parent for a child 3D object (visually representing the off-shooting limb) and any subsequent joints. The end effector is a final transform component added at the end of the final limb segment in the chain of joints, and this is where the FastIK Fabric script component is added.
Also present in Figure 2 is the transform objects acting as the target for a respective limb – these represent the target location the end effector should reach. An offset pole transform object was added as a child of this target transform to have consistent limb bending positioning. In figure 3, you can see the working projects result of the implementation of IK.
Project Idea Going Forward
Having last week explored Mesh Generation imitating terrain, and this authors desire to explore more realistic terrain, procedural animations can find a place within this – rough terrain is a good place for procedural animation to showcase its strength over traditional animation by allowing for accurate limb placement over rough terrain without mesh clipping. This will be realised in later weeks with the following video by Codeer (2020) acting as a baseline guide for implementing moving legs upon movement of the main body. 13
Reference
Ruuskanen, A. (2018) Inverse Kinematics in Game Character Animation. Bachelor's Degree in Business Information Technology. Kajaani University of Applied Sciences
Gazizov, R. and Shubin, A. (2024) ‘Modification of Skeletal Character Animation Using Inverse Kinematics Controllers’, 2024 International Russian Smart Industry Conference (SmartIndustryCon), Sochi, Russian Federation, pp. 553–557. doi: 10.1109/SmartIndustryCon61328.2024.10515984
Ruuskanen, A. (2018) Inverse Kinematics in Game Character Animation. Bachelor's Degree in Business Information Technology. Kajaani University of Applied Sciences.
Gazizov, R. and Shubin, A. (2024) ‘Modification of Skeletal Character Animation Using Inverse Kinematics Controllers’, 2024 International Russian Smart Industry Conference (SmartIndustryCon), Sochi, Russian Federation, pp. 553–557. doi: 10.1109/SmartIndustryCon61328.2024.10515984
Erdmann, D. (2022) Fast IK. Unity Asset Store. Available at: https://assetstore.unity.com/packages/tools/animation/fast-ik-139972#description (Accessed: 7 December 2024)
Erdmann, D. (2019) Free Inverse Kinematics in Unity 🎓 [YouTube video]. Available at: https://youtu.be/SHplmEc6iv0?si=cm8FtJHU_Qhr7LNW (Accessed: 7 December 2024)
EgoMoose (2016) FABRIK (Inverse kinematics) [YouTube video]. Available at: https://www.youtube.com/watch?v=UNoX65PRehA&app=desktop (Accessed: 7 December 2024)
Aristidou, A. and Lasenby, J. (2011) ‘FABRIK: A fast, iterative solver for the Inverse Kinematics problem’, Graphical Models, 73(5), pp. 243–260. Available at: https://www.sciencedirect.com/science/article/pii/S1524070311000178 (Accessed: 7 December 2024). doi: 10.1016/j.gmod.2011.05.003
Aristidou, A. (n.d.) Forward And Backward Reaching Inverse Kinematics. Available at: http://www.andreasaristidou.com/FABRIK.html (Accessed: 7 December 2024).
Erdmann, D. (2022) Fast IK. Unity Asset Store. Available at: https://assetstore.unity.com/packages/tools/animation/fast-ik-139972#description (Accessed: 7 December 2024)
DodginJam (2024) Lecture Three: Active Rag Doll. GitHub. Available at: https://github.com/DodginJam/Lecture-Three-Active-Rag-Doll (Accessed: 7 December 2024)
DodginJam (2024) Lecture Three: Active Rag Doll. GitHub. Available at: https://github.com/DodginJam/Lecture-Three-Active-Rag-Doll (Accessed: 7 December 2024)
Codeer (2020) Unity procedural animation tutorial (10 steps) [YouTube video]. Available at: https://www.youtube.com/watch?v=e6Gjhr1IP6w&app=desktop (Accessed: 7 December 2024)