Dungeon 1: The Charming Choreographer (Inverse Kinematics, 33g of total 100g). 1g may be exchanged
for a human percentage point in COMP5823M.
For the birthday celebration of Lord Spinhead, the Great Dancer Lady Anklesprainer is the master
choreographer. She has been designing a glorious but difficult dance show. After breaking some ankles,
she decides to use simulated characters to try some of her moves.
You, my loyal geniuses, will provide your assistance. You will build an Inverse Kinematics system to
animate human characters. It should come with a GUI which can load/save BVH files. It should be able to
play an animation clip from the BVH file and allow the user to control the positions of the joints by dragging.
For your hard work, Lady Anklesprainer has kindly agreed to give you rewards for:
- A GUI to load and play the BVH files in 3D. (5g)
- The same GUI to write BVH files. This should write an animation clip into a BVH file. (6g)
- A basic Inverse Kinematics (with pseudo-inverse) system which can handle positional constraints
for any single joint to update a posture (e.g. drag the right wrist and use IK to update the whole
body from the root). (7g) - A basic Inverse Kinematics (with pseudo-inverse) system which can handle positional constraints
for all combinations of joints to update a posture (e.g. position both hands and the neck
simultaneously to reach given target positions). (7g) - A damped Inverse Kinematics system that can accomplish 3 and 4. (4g)
- An Inverse Kinematics implementation with control on joints (refer to the slides for‘Adding
control’to IK). (4g)
The total reward is 5g + 6g + 7g + 7g + 4g + 4g = 33g.
Hint 1: There are several places in town where you can find assistance. (You can find the specs of BVH
files at https://research.cs.wisc.edu/… and some sample
code and BVH files in Minerva under Lab Resources)
Hint 2: You can use other BVH software to help you debug and test your system (BVH player
https://sites.google.com/a/cg…, BVH hacker http://www.bvhacker.com/)
The whole submission needs to be implemented in Visual Studio C++. It should be your own work
except for any third-party libraries. Make sure that you submit a zip file containing the whole Visual
Studio solution. You are free to use third-party libraries for GUI, rendering, triangulation, videocapture
and linear algebra operations, etc. But IT SHOULD BE STANDALONE SO THAT I CAN RUN IT ON
MY WINDOWS COMPUTER.
Some further hints below:
A human body skeleton can be represented as follow:
We already know that each joint includes an offset and a rotation (refer to the BVH file). We can stack all
the rotations (joint angles) into a long vector. If you have 25 joints in the skeleton and each has three
rotational angles, you can stack them into a 75×1 vector. Let’s call this vector θ. Now assuming that you
want to control the 3D position of one joint, e.g the right hand. Its position can be represented by a 3×1
vector Y = [px, py, pz]. Assume that the current position of the right hand is c and the joint angles are θ1.
The target position of the right hand is t and the IK aims to compute new joint angles θ2 so that the right
hand will be at t, by t – c = J (θ2 – θ1). Here both t and c are 3×1 vectors, and θ1 and θ2 are both 75×1
vectors. Naturally, the Jacobian matrix J is a 3×75 matrix. The only unknown here is θ2. t, c and θ1 are
known. We still need to compute J, by computing each entry of it. Let’s take a look at the structure of J:
To compute an entry, we look at one example . It can be computed by:
డ௫
డఏଵ ≈
∆௫
∆ఏଵ =
ଶିଵ
∆ఏଵ
Assuming θ1 is your root joint angle indicating its rotation around the x-axis, this entry essentially means
if the root rotates around the x-axis by a small amount say ∆θ1 = 0.001, the x coordinate of right hand
will change from p1 to p2 . So the only unknown here is p2. One way to compute it is to change θ1 by ∆θ1 ,
then do Forward Kinematics once to compute p2. You should already know how to do Forward
Kinematics (You already used it when you render the BVH file. Look at the code I shared for labs.).
Now we know how to compute the Jacobian J. The rest is the specific IK schemes you want to
implement for task 3-6. One change about controlling more than one joint is that Y is not a 3×1 vector
anymore. If you want to control two joints regarding their 3D positions only, Y will be a 6×1 vector. If you
want to control both the orientation and position of one joint, Y will also be a 6×1 vector.