Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quaternion value imported from VMD file is incorrect at some point #392

Open
xzhuah opened this issue Sep 24, 2022 · 1 comment
Open

Quaternion value imported from VMD file is incorrect at some point #392

xzhuah opened this issue Sep 24, 2022 · 1 comment

Comments

@xzhuah
Copy link

xzhuah commented Sep 24, 2022

I noticed that importing the same VMD file into Blender and MMD, results in slightly different pose at some key frames.

X8@QQYTHVL48{2ZF}_~HZ5X

I spent some time investigating what happened and I wrote a little python script to decde the VMD file and read the Quaternion value.
Now I saw the problem: when imported to the blender, the Quaternion value changed for some reason. The Quaternion value being used in blender is different from what is in the VMD file. When I manually correct the Quaternion value in blender, the pose restore to normal

4FA (_42%A$L{(BXX6FRUWU.

Could you please double check the VMD file loader to see why this happen?

@xzhuah
Copy link
Author

xzhuah commented Sep 24, 2022

I did some debugging, my finding is that: in the vmd/importer.py

For the BoneConverter.convert_rotation:

rot = Quaternion()
rot.x, rot.y, rot.z, rot.w = rotation_xyzw
return Quaternion(matmul(self.__mat, rot.axis) * -1, rot.angle).normalized()

I don't quite understand why we need to do that matmul calucation there. But if we return rot directly, the bone rotation of my above example would become visually correct. However, other bones would go wrong. So I guess, in some cases, we don't need to do that calcuation?

I also noticed that the error bone rotation typically happens when the rotation value change dramatically: like in the following diragram, it happen at those troughs.
GOZHUX`K8(00%PEZJ6OM TT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant