sigal-raab / Motion

Motion classes, based on Holden's code http://theorangeduck.com/page/deep-learning-framework-character-motion-synthesis-and-editing
24 stars 3 forks source link

Weird twists and joint jumps when global vertical root orienation changes a lot #3

Open dj-kefir-siorbacz opened 8 months ago

dj-kefir-siorbacz commented 8 months ago

I'm converting .npy to .bvh using the methods described here: https://github.com/GuyTevet/motion-diffusion-model/issues/32#issuecomment-1853388120 with BasicInverseKinematics class from this repo. For animations that turn around, i.e. root rotates about global vertical axis more than 180deg, some glitches are produced. Switching to Jacobian class doesn't eliminate the problem either

generated .bvh files with glitches

1 iteration .bvh: https://drive.google.com/file/d/1md9nnL1hm3KxeQObYoIhkvMo8pNuQRGL/view?usp=sharing

50 iteration .bvh: https://drive.google.com/file/d/1qx87mFa_w3Z4UVV-1AVWsQ3fozD6Vm1y/view?usp=sharing

higher iteration counts don't really improve the error, so I don't include them.

Video illustrating the problem for 50 iterations .bvh:

https://github.com/sigal-raab/Motion/assets/135321152/7d137594-f5e8-463d-97e1-9dad28bb817d

=> some joints change their twist (more than 90deg) rapdily during frames 180-185

my guess

maybe there is some issue with Quaternions being discontinuous at 180degs?

I also don't really know the math behind log, exp and mean of quaternions, so no idea if the code below is ok: image

sigal-raab commented 8 months ago

Good catch. I will take a look when I have a spare moment. Can you share the XYZ values (locations) on which you applied the IK?

dj-kefir-siorbacz commented 8 months ago

Sure, here is the .npy: https://drive.google.com/file/d/1qIdf4H8w0QNmomaTUBcjyGC7HtsU3yi_/view?usp=sharing

sigal-raab commented 7 months ago

Unfortunately not yet. Please ensure that the links to the npy and bvh files remain accessible.