Closed UuuNyaa closed 1 year ago
Thank you for the report and research 😃
Maybe it is a secondary problem caused by foot IKs. Can you share with me the .vmd file with the problem?
Sorry for late reply! Really happy that you can take a look into this:
The pmx model file and vmd file is here: https://drive.google.com/drive/folders/1-_ROl_-CtFzTqlNXT0prpKam3SfWFglT?usp=sharing
@xzhuah Thanks for the information. I will investigate.
@xzhuah I compared the loaded raw values with the converted values.
bone_name, frame_number, raw_location, raw_rotation
-> converted_location, converted_rotation
左足, 630, [0.0, 0.0, 0.0], [0.2948555648326874, -0.26610687375068665, -0.5102801322937012, 0.7627987265586853]
-> [0.0, 0.0, 0.0], [0.7627986669540405, -0.2989765703678131, -0.2356259971857071, 0.5227158665657043]
左足, 632, [0.0, 0.0, 0.0], [0.2948555648326874, -0.26610687375068665, -0.5102801322937012, 0.7627987265586853]
-> [0.0, 0.0, 0.0], [0.7627986669540405, -0.2989765703678131, -0.2356259971857071, 0.5227158665657043]
左足, 640, [0.0, 0.0, 0.0], [0.6728376150131226, -0.40922272205352783, -0.45866745710372925, 0.411642849445343]
-> [0.0, 0.0, 0.0], [0.4116428792476654, -0.6738986372947693, -0.3879457712173462, 0.4752987027168274]
左足, 641, [0.0, 0.0, 0.0], [0.6728376150131226, -0.40922272205352783, -0.45866745710372925, 0.411642849445343]
-> [0.0, 0.0, 0.0], [0.4116428792476654, -0.6738986372947693, -0.3879457712173462, 0.4752987027168274]
左足, 646, [0.0, 0.0, 0.0], [-0.0534103624522686, 0.059193193912506104, 0.0054518235847353935, 0.9968018531799316]
-> [0.0, 0.0, 0.0], [0.9968017339706421, 0.05259925499558449, 0.05953647941350937, -0.008662288077175617]
左足, 672, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]
-> [0.0, 0.0, 0.0], [1.0, -0.0, 0.0, -0.0]
Indeed the values are different. However, looking at other frames and bones, I think there is no mistake in conversion. So I think the problem is not an import bug, but an IK incompatibility. IK behavior differs between MMD and Blender, and cannot be perfectly matched.
As shown in the following video, changing the IK solver or adding a pole target resolves the problem.
That looks great! Thanks a lot
Copy from: https://github.com/powroupi/blender_mmd_tools/issues/392 by @xzhuah
I noticed that importing the same VMD file into Blender and MMD, results in slightly different pose at some key frames.
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
Could you please double check the VMD file loader to see why this happen?
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.