Inverse and Forward Kinematics in OpenGL

| June 5, 2023

This project explores forward, inverse, and scripted kinematics for hierarchical creature modeling in OpenGL. It features two different boned creatures: a worm-like creature featuring five interconnected bones, and a cube jellyfish with four three-boned arms. Both models have been crafted in Blender and loaded with the Assimp library. The control points and joints are calculated within the code, as the models do not incorporate them.

Interactions with the control points are calculated by projecting points onto the screen and calculating distances relative to mouse pixel coordinates. For forward kinematics, bone rotation angles are determined by control points, converted into quaternions, and applied seamlessly using vectors.

Inverse kinematics employ the CCD algorithm, offering flexibility with a variable number of bones. The algorithm’s termination criteria account for minimal distances and iteration limits, ensuring precision in reaching specified targets. This project displays a sophisticated behavior with up to five interconnected bones in three dimensions. Control point movement in three dimensions necessitates the creation of an imaginary plane mathematically defined by the vector from the scene center to the camera, allowing for unrestricted movement.

The final section addresses staged jellyfish animation using inverse kinematics, employing mathematical functions to propel control points along continuous splines. Initial attempts at forward kinematics lead to desynchronization issues, prompting a shift to this approach combined with sinusoid functions for enhanced realism. Additional out-of-phase functions accentuate resistance, creating a visually appealing illusion of tentacles gliding through water.

See the project on Github