Closed hoyeYang closed 2 years ago
Hi, the raw offsets gives the rough direction of each joint with respect to its parent joint, with z+ the face direction and y+ the up direction. For example, joint 1 is at the right of joint 0, so the raw offset is [1, 0, 0]. In our case, the norm of raw offset must be 1.
In skeleton, we will the calculate the exact bone lengths (i.e., offset) https://github.com/EricGuo5513/HumanML3D/blob/main/common/skeleton.py#:~:text=def%20get_offsets_joints(,return%20_offsets. During inverse kinematics, the local rotation of each bone is obtained as the rotation between skeleton bone and pre-defined raw-offset direction in local system https://github.com/EricGuo5513/HumanML3D/blob/main/common/skeleton.py#:~:text=0.0%2C%200.0%2C%200.0%5D%5D)-,for%20chain%20in%20self._kinematic_tree%3A,R%20%3D%20qmul_np(R%2C%20R_loc),-return%20quat_params. While in forward kinematics, we will operate the rotation and displacement (bone length) along the kinematic chains. https://github.com/EricGuo5513/HumanML3D/blob/main/common/skeleton.py#:~:text=joints%5B%3A%2C%20chain%5Bi%5D%5D%20%3D%20qrot(R%2C%20offset_vec)%20%2B%20joints%5B%3A%2C%20chain%5Bi%2D1%5D%5D
This inverse/forward kinematics may need some background knowledge. I attached a script which may help you understand this process. Note the script is using Lie Group/Algebra representation. While in our case, it's quaternion.
If you want to add other joints, you need to append these joints in existing kinematic chains. So these joints could be reached while inverse/forward kinematics along chains. These chains are the structure of the human body. For raw offset, We ususally make it roughly align with a pre-defined pose, which help animation in 3D software. But, as long as you keep its norm as 1, and keep it the same while inverse/forward kinematics, it should be fine. You could check whether you could reconstruct the positions by inverse and then forward kinematics. If you could, then you should be alright.
Thanks a lot!
Thanks for your great work! I wonder what the raw_offsets in paramUtil.py stands for? https://github.com/EricGuo5513/HumanML3D/blob/e8417a6030844bc9f09767b6831a27b00330b1da/paramUtil.py#L32-L57 And if I want to add another two joints (22 and 37) how to modify the raw_offsets and kinematic_chain? Could you give me some help?