Practice for some popular IK implemntaion in OpenGL 2.0
Make sure you build in Release Mode
My understanding of speed&performance for different IK methods May be different based on how many joints you have
Fast ←------------------------→ Performance CCD FABRIK Jacobian
git submodule update --init
.- download glfw pre-compiled library and put the uncompressed files under
3rd_party/libglfw
.- alternatively you can build by yourself, but make sure the
include
andlib
are under3rd_party/libglfw
- alternatively you can build by yourself, but make sure the
- run
cmake -S . -B build
under/0_ikccd
or/1_skeleton_ik
or/2_ik_jacobian
or/3_FABRIK
folder. /***/build/***.sln
will be the Visual Studio solution files, open it and build in Release mode.
- Using W S A D control the horizontal movement of the target
- Using E Q control the vertical movement of the target
- Using 1 2 3 4 switch between four different target IK
- Using Hold ALT + Left Click control the camera
- Using Scroll up/down control the camera zoom in/out
- CCD
- Basic
- Hinges (Constraint of rotation axis)
- Limits (Constraint of rotation angle)
- FABRIK
- Jacobian
- Jacobian Transpose
- Jacobian Inverse
Constraints are on first 3 joints. Green joint only can rotate along local Y axis,
Red joints only can rotate along local X axis, with constraint of Euler degree between -90 , +90 degrees.
All IK implementation using a custom 3D struct built by myself
No external library for 3D object
Applying the CCD IK on rig bones
Local to world coordinates. The dfm2::CRigBone is the bone structure developed by Prof.Umetani. We must be careful when dealing with the IK in world space because we must convert the rotation to local space.
By using quaternion, the process will be straightforward to compute.
Using Jacobian Transpose and analytical method to compute the Jacobian Matrix
Currently it only rotates along Z axis, I'm working on adding X and Y axis rotation
In 2D case, every bone's rotation axis is always the Z axis (0,0,1), but in 3D case each bone's rotation axis will change based on parent's bone
Analytical method formula
J = jacobian
a = rotation axis
e = end effector position
r = joint position
I set a small number of maxmium iteration per frame, so you can clearly see how the joints moving with slow speed
No constraints applied
Practice for some popular IK implemntaion in OpenGL 2.0 Copyright Yifei Chen