sugiany / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
Other
1.03k stars 631 forks source link

VMD file interpolation data - What does it mean? #41

Open Hogarth-MMD opened 9 years ago

Hogarth-MMD commented 9 years ago

VMD file interpolation data - What does it mean?

Using the Interpolation Curve in MikuMikuDance: http://learnmmd.com/http:/learnmmd.com/using-the-interpolation-curve-in-mikumikudance/

More Motion Interpolation Curve Instruction for MMDers: http://learnmmd.com/http:/learnmmd.com/more-motion-interpolation-curve-instruction-for-mmders/

The curve and its control points are located on a 128 X 128 grid (0-127 X 0-127) There are 2 control points for each interpolation curve. Each control point has an x co-ordinate and a y co-ordinate. Each co-ordinate is defined by a 2-byte integer. The x, y and z axes of a camera or of an ordinary rotating object each need to have a pair of control points. Therefore 24 bytes of interpolation data for a camera or for an ordinary rotating object.

Each bone has w,x,y and z values for quaternion rotation. Each bone needs to have 2 sets of quaternion values. Therefore 64 bytes of interpolation data for each bone. Unfortunately, I have absolutely no idea why a bone would need to have 2 sets of quaternion values instead of just 1.

I am not sure if these ideas are correct, but I hope that they give a helpful clue to solving the puzzle. These ideas are just my own inductive/deductive theorizing. Sorry, but I don't have any authoritative or complete information.

Hogarth-MMD commented 9 years ago

Or instead of a 2 bytes integer, 2 1 bytes integers, 1 for location interpolation and 1 for rotation interpolation(?). And for the quaternions, 2 of these spaces: world space, local space, object space, local space with parent(?). Sorry, my understanding of this is all a work-in-progress.

Hogarth-MMD commented 9 years ago

In Blender, this may be similar to the MMD animation interpolation curves which are stored in a .vmd animation file:

The making of Sintel : animation lee https://www.youtube.com/watch?v=c4sCUgM7IBU

At 7 minutes 45 seconds in this video tutorial: keyframing of animated strip time in the NLA editor allows speed of an animation to be controlled by another curve in the graph editor.

I hope that you can use this information to make a .vmd exporter for Blender! MMD is awesome. Thanks so much for your efforts! :-)

RenaKunisaki commented 4 years ago

Did you ever figure this out?

alloystorm commented 1 year ago

From what I can find from here: https://github.com/benikabocha/saba/blob/master/src/Saba/Model/MMD/VMDAnimation.cpp

It seems for bone animation not all 64 bytes are used. It only uses 4 bytes each for x, y, z and rotation. Only 16 bytes within those 64 bytes are useful.

For camera motion, all 24 bytes are used, in addition to x, y, z and rot, it also has interpolation for distance and fov. So in total 4 x 6 = 24.