Wednesday 14 May 2014

Animating with Mikoto – part 5

For my character I will use the Lara Croft model from a Tomb Raider Level Editor (TRLE) *.wad file.

The post http://sappersblog.blogspot.com/ tells where to obtain TRLE or *.wad files if you don’t have them.

Open the *.wad file in version 1.4 of my EditWad program.

Information about EditWad can be found at http://www.tombraiderforums.com/.
EditWad can also be downloaded from http://www.trsearch.org/Tools/25/.

EditWad has a console window and a GUI window. The console window only displays information.

EditWadConsole

All interaction is with the GUI window.

Click on the slider and drag it to the far right until the number on the top right blue button is “7”.

EditWadGUI

Click the blue button with the “7” on it to bring up the save dialog and save the *.mqo file.

Close EditWad as it is no longer needed.

Open the file you saved in Metasequoia.

Note that meshes are exported from EditWad at 1:1 scale and meshes in TRLE *.wad files are big.

You may need to change the Distance setting in Field of view by clicking View>Set View.

LaraInMeta




If you wish to have the model textured, open in TextureAdd, the same *.wad file you opened in EditWad. (TextureAdd info hyperlink, TextureAdd download hyperlink)

Click Edit>Texture Pieces>Export All and save the texture pieces as *.bmp in the same folder you saved the *.mqo file.

WARNING: Hundreds of *.bmp files will be saved (1581 in this case).

TextureAdd

Close TextureAdd and open the *.mqo file once again in Metasequoia. If you have View>Show textures checked then the model should appear textured.

LaraTexturedInMeta

The model includes the joint meshes which aren’t required so delete all the following objects.
  • neck
  • left and right shoulders
  • left and right elbows
  • left and right wrists
  • waist
  • left and right hip
  • left and right knees
  • left and right ankles
Save the *.mqo file.

LaraNoJointMeshes

The screenshot below shows Lara in Mikoto.

LaraMikoto

We need to create a skeleton in Metasequoia so we can animate Lara.

I will try and create the skeleton to match the structure of Lara’s meshtree (skeletal hierarchy) in the *.wad file because hopefully one day, someone will be able to convert animations stored in Mikoto’s *.mkm motion files to Wadmerger’s AnimEdit *.trw files or to Milkshape3D *.ms3d files.

Mikoto’s *.mkm files are text files in which rotations are stored as quaternions and *.trw files are binary files in which rotations are stored as Euler angles in YXZ order.

See http://www.evpopov.com/perso/dl/TRStone/TRLevelFileFormat.html Section V. Mesh Construction and Animation for details about animations in Tomb Raider.

See http://sappersblog.blogspot.com/ for details about the *.trw file format.

Below is a screenshot of Lara’s structure in MisFit3D. Lara was exported to *.ms3d format from a *.TR4 file using Fexanim.

LaraMisFit3D

We need a bone for each of Lara’s meshes.

Only Lara’s pelvis bone translates in Tomb Raider so we will have to make the pelvis bone the first in the hierarchy.

The pelvis bone is connected to three bones, the chest and each leg. If we make these connections in Metasequoia with lines and not directly connect the triangles then we will be able to use IK for the legs and the upper half of the body.

Firstly we will add some new materials to our Metasequoia document which we can use to name our bones.

Click New in the Material Panel to create a material and then double click on its name to open the Material Property Editor.

Change the material name to “head”.

MatName

MatProperty

Create materials for the rest of the bones in the same way with the following names.
  • chest
  • pelvis
  • upperarm[]
  • lowerarm[]
  • hand[]
  • upperleg[]
  • lowerleg[]
  • foot[]

Materials

Our model straddles the Z axis so we can create left/right bone pairs.

If we have left/right bone pairs we can use the mirror pose and symmetrical pose features in Mikoto.

Hold the SHIFT key and press F1 to get a side view in Metasequoia.

Select the Head object and then click Misc>Show selected only in the Object Panel menu.

With the Head selected, click Local in the Command Panel and click Property in the Local axis dialog.

LocalProperties

Write down the X, Y, and Z Position values and close the Local axis property dialog without changing anything.

This position is the point about which Lara’s head rotates so we need to create the root point of our triangle at this point.

Create a new object by clicking New in the Object Panel and rename that object bone:.

With the bone: object selected, click Create in the Command Panel and click Front and Tri in the Create Face dialog.

Enter the X, Y and Z position values you wrote down into the X, Y and Z edit boxes of the Create Face dialog and then click Add.

FirstTriangle

The first point of our triangle is created in the 3D view. Now click two more times to create the triangle as shown below.

FirstTriangle2
        FirstTriangle3

Hide the head object and unhide the Chest object and create the chest bone using the Local axis position X, Y and Z values for the Chest object.

Remember to select the bone: object before creating the triangle.

This time the tip point of the triangle will be connected to the root point of the head triangle using CTRL+click.

ChestTri

Next is the pelvis triangle with the tip point joined to the root of the chest triangle.

PelvisTri

Next is the right hand. We will create all the bones in the arms pointing down.

RHandTri

Right lower arm. The tip will be joined to the root point of the hand triangle.

RLowArmTri

Right upper hand with the tip joined to the root of the lower arm.

RUpArmTri

Press F1 to get a side view of the left side of the model.

Create the bones for the left arm all pointing down and with the upper arm joined tip-root to the lower arm and the lower arm joined tip-root to the hand.

LeftArm

Since we are viewing the left side of the model we will do the left leg next.

All the bones in the leg will point down and we will create them in the order foot, lower leg, upper leg so that we can join the tip of the current bone to the root of the previous bone.

Notice the foot bone is angled and not vertical to more closely match the foot.

LeftLeg

Hold SHIFT and press F1 to view the right side of the model.

Create the bones of the right leg.

RightLeg

Now to complete the skeleton we need to connect some triangles with lines.

In the Create Face dialog click Line.

Hold CTRL and click on the root point of the left upperleg triangle and then hold CTRL and click on the tip point of the pelvis triangle.

LegPelvisLine

Hold CTRL and click on the root point of the right upperleg triangle and then hold CTRL and click on the tip point of the pelvis triangle.

Next connect the root point of the upperarm left and right triangles with a line to the tip of the chest triangle.

All my triangles were created with the foot[] material selected so now I have to apply the correct materials to the triangles.

Click Mat in the Command Panel, select a material for a bone and then click on the corresponding bone to apply that material. Repeat for all the triangles in the bone: object.

Applying materials to triangles

Save the *.mqo file open it in Mikoto and click on the filename in the tree next to the cyan cube to see the bones.

Click on a bone and click OK to add a motion and then rotate the bones to pose Lara.

Check that the the correct parts of the model rotate with a bone.

If not, in Metasequoia, check that the points that are supposed to be joined are joined and that each triangle has the correct material applied.

Also test whether the skeleton design has good useability.

I notice that moving the tip of the head bone moves the pelvis bone due to the IK chain from head to pelvis and this may be undesirable.

To fix it, in Metasequoia, select the bone: object and delete the pelvis triangle. Select the pelvis material and then recreate the pelvis triangle but do not join it to the chest triangle. Connect its tip with lines to the chest and upper leg triangles and save the *.mqo,

LaraPosed

TR4LaraCroftMQO.zip



prev | next

No comments:

Post a Comment