In bits of free time over the last couple of months, I’ve been working on implementing the FABRIK inverse kinematics solver in Panda 3D, with the end goal of producing something sufficiently general that anyone can drop it into a project without much bother. For those of you not familiar with FABRIK, in short it’s a heuristic IK solver, that uses conformal geometric algebra in an forward and backward (up and down kinematic chains) iterative fashion. Check out the paper here, and the website here if you’re interested.
Some of the advantages:
- It’s fast, even when constrained.
- It doesn’t suffer from the same singularity issues as many other solvers.
- Can be used with multiple joined chains with multiple effectors.
- Produces visually smooth movements without oscillations and discontinuities.
Thus far I’ve implemented the basic unconstrained algorithm, and tested it with a single chain for both a reachable and unreachable target, and it seems to perform well. I made a short teaser video, which you can watch here. It’ll look weird at the moment, since the solver uses joint positions rather than orientations, and I’ve not yet implemented anything to re-orient the joints after they’ve moved. That’ll be done next, together with methods to constrain the joints (the other reason why it looks weird). After that I’ll be tying it together to work for multiple kinematic chains/effectors, and creating some helper features so that, for example, you can set targets on an actor’s joints, and the kinematic chains are automatically built, linked, and solvers started. Basically it should be as easy as specifying where you want a limb to try to go. After that I’ll look at using it to do things like automatic grounding of feet, automatically turning eyes/head/torso to look at something. Things like that. I may also have a go at adding a solver for muscle bulging based on angles between limbs.
Anyway I’ll be trying to keep this thread up to date with progress as it happens, and hopefully pretty soon I’ll put this up on Github or the like so that people can play with it if they wish, and give some feedback. Big thanks to rdb, and also to Thaumaturge for getting me this far, and of course thanks to the folks who came up with the solver.
Update 5/10/2014: I’ve gotten joint reorientation working well using a quaternion method, since lookAt() doesn’t work properly if bones aren’t Y-axis aligned. I’m working on constraints at the moment, but it’s taking a little time since I’ve not really used quaternions much until now, so I’m having to do some reading before I can understand the maths required to implement the constraints (it’s not straightforward HPR clamping). I’ve also quickly tested the solver using one of the sample models that come with Panda, and it works great apart from a strange direction offset (the limb is pointing/moving in the opposite direction), so I’ve got to investigate why that’s happening in case I’ve made a mistake that my usual test model was hiding. Onwards and upwards.