Sunday, 1 June 2014

Mikoto2x instructions

Mikoto2x [link] [link2] is a program to convert animations created in Mikoto to the Direct3D *.x text file format.

Mikoto is a program that can be used to animate models created in Metasequoia.

The model has to include special objects and object names for animation to be possible in Mikoto. See the tutorial here [link].

Mikoto2x requires the vertices of the character mesh to be assigned to the bones using the anchors method in Metasequoia.

Anchors are boxes that envelop all the vertices that are to be assigned to a bone.

Reading the translated “readme.txt” [link] it may required that the effector must be bdef: only and that the character mesh must be in a single object but I have not had time to clarify this.

I will just show how to use Mikoto2x at this time and update the post later with the requirements for the model.

Create a new folder somewhere on your PC and copy the following files from Mikoto2x’s sample folder to the new folder.
  • “kobito.mqo”
  • “kobito.m2x”
  • “df_00.bmp”
  • “df_01.bmp”
I will be using the freeware MetasequoiaLE R3.0.

It is yet to be confirmed whether Mikoto2x is compatible with *.mqo files saved from Metasequoia 4. Metasequoia 4 default *.mqo files are version 1.1 whereas Metasequoia 3 default *.mqo files are version 1.0.

Open “kobito.mqo” in Metasequoia.

Open model in Metasequoia

You need to save each object to a separate Direct3D *.x file. For this reason you need MetasequoiaLE or a registered version of Metasequoia.

IMPORTANT: Each *.x file must be saved in the same folder as “kobito.mqo”.

The object named “bdef:body” is our character’s mesh (skin), the object named “bone:body” is our character’s skeleton and the object named “anchor|body” contains all the anchors (boxes) that assign the vertices to the bones in the skeleton.

To save the skin, hide the other two objects and then click File>“Save As”.

Make body only visible object

In the Save As dialog, name the file “skin” and make sure to select Direct3D retained Mode (.x) as the file type from the dropdown list.

Save as Direct3D Retained Mode file

In the X Export setting dialog change “Multiply” to 1 and make sure “Visible objects only” is checked/ticked.

Also check/tick “Normal vector” and “UV mapping”. I don’t know if you need to check/tick “Vertex color” but I did anyway.

Leave the “Axis” settings at the default values and press OK to save “skin.x”.

Use these X Export settings

The translated “readme.txt” mentions dragging and dropping the “skin.x” file onto the xsmooth.exe program that is bundled with Mikoto2x but I need to clarify this.

Save the skeleton the same way as for the skin. Use the filename “bone.x”.

Save the skeleton

Save the anchors the same way. Use the filename “anchor.x”

Save the anchors

Exit Metasequoia without saving the changes and open “kobito.mqo” in Mikoto and give the “kobito.mqo” item scope by right clicking on it in the treeview and clicking “Scope” in the context menu.

In untranslated versions of Mikoto look for the context menu item with the shortcut key ‘S’.

Open model in Mikoto and give it scope

Click on a bone in the 3D view and press OK in the dialog to create a new motion named “motion”.

IMPORTANT: Do not rotate or move any bones or create any more keyframes for this motion. Do not create any other motions yet.

Click on a bone to create a new motion

You can right click on the motion and rename it if you wish.

Mikoto2x needs to know the initial pose (also known as rest pose) of the model which is the model’s pose before any bones have been moved or rotated.

Right click on the “kobito.mqo” item to display the context menu and then click Export. The letter ‘E’ is the shortcut for Export.

Save the initial pose to the same folder as the *.mqo and *.x files. Select “Mikoto Motion Files (*.mkm)” from  the “Save As Type” dropdown list and give the file the name “init.mkm”.

Exporting to a Mikoto Motion *.mkm file saves every motion in that file so make sure you save the initial pose before you create or import any other motions (animations).

Next create your animations.

Create a new motion for each animation. The easiest way is right click on the initial pose motion we created and clicking “Copy” in the context menu.

Click on the new motion in the treeview before starting to animate the model to make that motion the active motion.

Animate the model

Make sure to save your project often as a Mikoto Scene (*.mks) file since Mikoto can stop running unexpectedly. Do not save from the File>”Save As” menu since it seems not to actually save anything in the file (0kB). Use the right click context menu and Export, selecting *.mks as the filetype from the dropdown list.

When you have created your animation or animations, again Export your motions to a *.mkm file. Save in the same folder with the *.mqo, *.x and init.mkm files. Use the name “kobito.mkm”.

Exit Mikoto and open the “kobito.m2x” file in a text editor like Notepad.

If you use Notepad you will need to change the file type from Text Document (*.txt) to All Files (*.*) in the Open and Save dialogs or rename the file with a .txt extension.

Mikoto requires the extension to be .m2x so don’t forget to change it back.

The contents of “kobito.m2x” are shown below.

mqo kobito.mqo
mkm kobito.mkm
init kobito_init.mkm
skin kobito_skin.x
bone kobito_bone.x
anchor kobito_anchor.x
out kobito.x

The first column contains the identifiers required to be in the *.m2x by Mikoto.

The second column contains filenames.

The identifiers must be the same as listed above but the filenames may be changed to match the filenames chosen when saving the various files.

The filename on the “mqo” line must be the filename of the *.mqo file and doesn’t need to be changed in this case.

The filename on the “mkm” line must be the filename of the *.mkm file containing the animation and doesn’t need to be changed in this case.

The filename on the “init” line must be the filename of the *.mkm file containing the initial pose. Change it to “init.mkm”.

The filename on the “skin” line must be the filename of the *.x file containing the skin of the model. Change it to “skin.x”.

The filename on the “bone” line must be the filename of the *.x file containing the skeleton. Change it to “bone.x”.

The filename on the “anchor” line must be the filename of the *.x file containing the anchors. Change it to “anchor.x”.

The filename on the “out” line is the output filename. This file will be created in the folder and contain the animation in *.x format. Leave it as “kobito.x” in this case.

Make the changes above and save the *.m2x file.

“kobito.m2x” should now look like this.

mqo kobito.mqo
mkm kobito.mkm
init init.mkm
skin skin.x
bone bone.x
anchor anchor.x
out kobito.x

To create the output file “kobito.x”, drag and drop the file “kobito.m2x” onto “Mikoto2x.exe”.

It’s probably easiest to have the Mikoto2x folder open in one Windows Explorer window and the folder with the *.mqo, *.x , *.mkm and *.m2x files open in a separate Windows Explorer window so you can drag and drop the *.m2x file between the two windows.

Drag and drop kobito.m2x onto Mikoto2x.exe

A command prompt window will briefly appear and the output file will be created in the same folder with all the other files we saved. A file with the same name will be overwritten.

You can drag and drop the output file “kobito.x” onto the XAnimationMesh program found in the same folder as Mikoto2x to view the file. The Up and Down cursor keys cycle through all the animations, clicking and dragging the right mouse button rotates the camera and clicking and dragging the left+right mouse buttons zooms the view.

Drag and drop kobito.x onto XAnimationMesh.exe to view the animation

fragMOTION [link] can also open *.x files but for it to open my “kobito.x” file I found it was necessary to drag and drop the “skin.x” file onto “xsmooth.exe” in the Mikoto2x folder to create a modified “skin.x” and then create a new “kobito.x” output file.

The animation also appeared mirrored compared to Mikoto and XAnimationMesh.

The animation appears mirrored in fragMOTION

The C++ source code for Mikoto2x is included so any programmers interested in writing a converter to another format can study how Mikoto2x transforms the quaternions stored in the *.mkm file to another coordinate system and rotation format.

More about Mikoto2x here. [link]

No comments:

Post a Comment