vchoutas / smplx

SMPL-X
https://smpl-x.is.tue.mpg.de/
Other
1.79k stars 304 forks source link

One question about the function batch_rigid_transform #64

Closed y200504040u closed 3 years ago

y200504040u commented 3 years ago

I'm confused about the function batch_rigid_transform which computes the 3d coordinates and absolute joint rotations using the relative rotations and the kinematic chain. The inputs are the parent-relative rotation matrices, the joints at rest pose and the kinematic chain.

https://github.com/vchoutas/smplx/blob/f4206853a4746139f61bdcf58571f2cea0cbebad/smplx/lbs.py#L345-L394

Take joint 1, joint 2 and joint 3 whose parent joint is joint 0(the root joint Pelvis) as an example: Coordinate of joint i after rotation (whose matrix denoted by Ri) is denoted by ti', coordinate of joint i of the rest pose is denoted by ti. Temporarily without considering global orientation, derivation is as follows: 'L_Hip':1 t1' = R1(t1 - t0) + t0 'R_Hip':2 t2' = R2(t2 - t0) + t0 'Spine':3 t3' = R3(t3 - t0) + t0 However, derivation described by code is as follows, which seems to have nothing to do with R1, R2, R3: 'L_Hip':1 t1' = R0(t1 - t0) + t0 'R_Hip':2 t2' = R0(t2 - t0) + t0 'Spine':3 t3' = R0(t3 - t0) + t0 In my mind, the joint of rest pose should be multiplied by the the current joint's rotation matrix about the current joint's parent joint, instead of its parent joint's rotation matrix about its parent joint's parent joint. I don't know where I was wrong.