An IK solver written in OpenGL to control a joint chain
Apr 2007
CG Programming
IK Using Jacobian Matrix
@ programming > rigging & deformation

Inverse kinematics is a form of kinematics where we define a position for the end effector and the joints in the joint chain gets rotated such that the end effector reaches the desired position. This is generally hard to solve due to its non-linearity.

The IK that I calculated in this program is done using Jacobian matrix J(θ) in the equation dX = J(θ) dθ. This is an approximation and iterative approach to converge on the solution, which is an expensive but general solution to IK problems. It uses the idea of derivatives to approximate a local linear solution to the generally non-linear IK problem.

In this OpenGL demo, the user can press the spacebar to generate a random point in space. This point is calculated using spherical coordinates to ensure that it lies within the top hemisphere of radius L, where L is the length of the joint chain, so that the end effector can reach it.

Video showing the IK algorithm at work. End effector moves towards a green random point generated.

The empirical results that I have obtained are pretty decent since the end effector is able to move to desired position fairly quickly within a certain positional threshold. Note that the video above is playing at approximately 3 times the normal speed.

The joint chain that is set up is one which is able to reach any point in a sphere of radius L, where L is the length of the joint chain. It has a base (of two joints with 1 degree-of-freedom each) which can rotate around the y-axis for azimuth angle and rotate up/down for the elevation angle. This basically covers all orientations about the base. The three non-zero-length bone setup ensures that all points within the sphere can be reached, as opposed to a two-bone setup where some points cannot be reached.

Note: Scene setup by Neo Jiet Shern.

Skeel Lee Skeel Lee
Facebook Google+ Twitter Tumblr
YouTube Vimeo Flickr Pinterest
Senior FX TD / R&D
Digital Domain 3.0 (Previously at Sony Pictures Imageworks, MPC, Industrial Light & Magic, Double Negative)
LinkedIn IMDb GitHub Stack Overflow
I am a Senior Technical Director with strong interests in both tech and art. My life evolves round VFX, photography, software engineering, tools programming and generally anything that looks / sounds cool.
I have done a variety of CG programming, including fluid sims, muscles, soft/rigid bodies, raytracing etc. These knowledge complement the visual works that I do as a TD in VFX.
I was interviewed by The Straits Times in May 2014 for my VFX work in X-Men: Days of Future Past.