Exporting animations using Maya and OgreMax

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
MrFigaro
Gnoblar
Posts: 2
Joined: Fri Dec 03, 2010 12:21 am

Exporting animations using Maya and OgreMax

Post by MrFigaro »

Hi,

I am struggling to understand the animation export pipeline for Maya/OgreMax to Ogre (1.7).

I successfully use OgreMax to export meshes, materials, meshes bound to joints, etc. I can also export a single animation for a mesh bound to a joints, by animating the skeleton and adding it to the Mesh object's Mesh Animations list in the Mesh Animations tab.

Where it all goes wrong is when I want more than one animation. I have a Maya file with the mesh and bones, and several Maya files containing different animations (with the original Maya file referenced inside it), e.g. Stand.mb, Walk.mb, Run.mb. However I do not know how to export these as one mesh file, one skeleton file (containing references to the animations) and seperate animation files.

I can only refer to the one animation in each file in the Mesh object's Mesh Animation list.

Exporting each animation file in turn causes it to overwrite the mesh and skeleton file afresh, each time with the same mesh and a different skeleton file (containing the same joint info, and one reference to the current animation).

If I create a Maya file with all the animations referenced inside it, there are multiple instances of the mesh, each with one animation bound to it. Exporting one mesh just acts as it did before, exporting the scene exports all the animations, but also multiple copies of the mesh. The Mesh and bones with the animations are tightly linked and it seems impossible to refer to animations on a different set of joints.

The only way I can see to even attempt it is to add all the animation key frames on to the same set of joints, in one enormous animation, and add the animation entries with the range on each one. If this really is the only way to do it, then it is completely unusable, as that would soon become unwieldly and unmaintainable.

I can only think I have missed something completely in how to do this.

Could anyone please describe to me their working pipeline, preferrably with OgreMax? But if you can recommend a different Maya export tool, I am willing to try anything! I am at a total loss as how to get my character to have more than one animation available to it! :-)

Thanks!
videl
Halfling
Posts: 54
Joined: Mon Oct 26, 2009 7:40 pm
Location: Switzerland

Re: Exporting animations using Maya and OgreMax

Post by videl »

Just check out die Trax Editor, that's what you need

First you create a Character Set with all you control curves. Then you create a Animation Clip from all of your animations. You can import/export animation clips between maya files. You can easily arrange the clips in the trax editor to a huge animation and then export it.
MrFigaro
Gnoblar
Posts: 2
Joined: Fri Dec 03, 2010 12:21 am

Re: Exporting animations using Maya and OgreMax

Post by MrFigaro »

Thanks Videl. Following your advice, I have managed to export multiple animations for a mesh. As there appears to be no documentation for new Ogre users to follow regarding this pipeline, I'm posting the Animation Pipeline documentation I have created for our artists to follow. I hope it makes sense, and will help anyone else struggling to do it. Any comments/corrections welcome.

Code: Select all

Animation Pipeline for Maya and OgreMax in to Ogre
==================================================
by MrFigaro

+ Pre-Requisites:
    + Install Maya
    + Install OgreMax (http://www.ogremax.com/downloads)

+ Model the character:
    + Start with an empty maya file, e.g. Demon.mb
    + Model the character using polygons.
    + Texture it.
        + The textures must be referred to relative to the maya file.  
        + The textures must exist in the resource.cfg, with the same relative path.
        + The easiest way to do this is to have the textures in the same folder as the maya and output files.
    + Add a skeleton if required.
        + The model MUST be skinned with soft bind skin ([Animation]->Skin->Bind Skin->Soft Bind).
    + Create a Character Set.
        + Select the mesh and ALL the bones (not just the top bone).
        + [Animation]->Character->Create Character Set.
        
+ Create an animation:
    + In a SEPERATE Maya file (e.g Walk.mb or Run.mb), add a REFERENCE to the model file:
        + File->Create Reference
    + Animate the skeleton.  I think the animation needs to BAKED in, as animation clips need key frames before they can export.  
        + This is only a problem if IK or other such animation helpers have been rigged up to the skeleton.
        + There may be a way around this if you add any rig to the character set?  Needs experimenting with.
    + When ready, export an Animation Clip:
        + Select the Character Set
        + Open the Trax Editor (Window->Animation Editors->Trax Editor)
        + Create an Animation Clip (Create->Animation Clip)
            + A clip of your animation should appear in the timeline.
        + Name the clip to be the same name as your animation.
        + Select the clip in the Trax Editor.
        + Export it to the same file name as your animation, but with a .ma extension. (File->Export Animation Clip...)
    
+ Export the model and animations:
    + Create an empty Maya file for collecting the animations together, e.g. DemonAnimations.mb
    + Add a REFERENCE to the model file (File->Create Reference)
    + Open the Trax Editor (Window->Animation Editors->Trax Editor)
    + Create a track for the character (Create->Animation Clip)
        + This will not insert anything (and will moan about no keys being set, but ignore this - // Error: No clip created since character has no keys.)
    + Import all the animations:
        + File->Import Animation Clip To Characters...
        + Add the Animation Clips (e.g. Walk.ma, Run.ma)
    + Spread the animation clips out along the time line.
        + DO NOT let them overlap or even but up against each other, otherwise the animations will "bleed" in to each other.  Leave a gap.
    + Add the animation entries to the mesh object OgreMax data.
        + Select the mesh.
        + OgreMax->Object Settings...
            + Select the Mesh Animations tab
                + Mesh Animation Type: Skeleton
                + Export Skeleton: Yes
                + Export Animations to Seperate Skeleton Files: FALSE
            + For each animation clip in the trax editor, press the Add... button
                + Set the name (e.g. Walk, Run)
                + Set the Start/End frames, as displayed in the Trax Editor for the clip (bottom left and right values)
    + Once all the animations are in the list, you can export the model:
        + Select the mesh.
        + OgreMax->Export->Export Selected Objects...
        + Choose a FileName (e.g. Demon.mesh)
        + Save as type: OgreMax mesh (*.mesh)
    
+ Import character in to Ogre:
    + The export process will have generated a .mesh, .skeleton and a .material file.
    + Copy these and any textures in to the Resources folder.  You could zip them first, e.g. Demon.zip
    + Add a reference to the files in the resources.cfg file.
    + The mesh should now be available in the game, and all the animations should be useable.
SusanLL
Halfling
Posts: 41
Joined: Thu Jan 06, 2011 9:47 pm

Re: Exporting animations using Maya and OgreMax

Post by SusanLL »

MrFigaro

Thank you for the info. Maybe at some point we can start compiling all these current "How To's" into a centrail respository.

I figure if we continue to utilize Ogre's features into my(our) modeling and animation pipeline then I will generate a video or instructional doc's that artist can reference. I know the videos are old and out dated, but with them and your current docmentation I am finding some useful resource info.

Thanks for your time on behalf of other artist-
Susan :)
SusanLL
3D Modeler, Models and Simulations
BAE Systems, Inc
susan.littleton@baesystems.com
Lolsd
Gnoblar
Posts: 2
Joined: Tue Oct 18, 2011 8:43 pm

Re: Exporting animations using Maya and OgreMax

Post by Lolsd »

I'm having a lot of trouble even getting ONE animation to show up correctly exporting with OgreMax and Maya. The problem I'm having is only one joint is moving while the other body parts are frozen. I can get them to move by having each leg piece have a different animation name (run0, run1, run2, run3) in the viewer, but in ogre it still doesn't work. Is there a special way I need to rig or animate my character in order to get him to output an animation correctly? So I can have only one run cycle the applies to all the meshes.
yannischris
Gnoblar
Posts: 11
Joined: Sat Jan 21, 2012 9:41 am

Re: Exporting animations using Maya and OgreMax

Post by yannischris »

Mr. Figaro thank you for the very helpful pipeline description!!
I have one question? In the next part of your description:

+ Create an animation:
+ In a SEPERATE Maya file (e.g Walk.mb or Run.mb), add a REFERENCE to the model file:
+ File->Create Reference
+ Animate the skeleton.

Do you mean that I should return to the original file in order to animate, or do it in the reference file?

Thanks again for the useful contribution!
yannischris
Gnoblar
Posts: 11
Joined: Sat Jan 21, 2012 9:41 am

Re: Exporting animations using Maya and OgreMax

Post by yannischris »

Hello Mr Figaro,
First of all thank you so much for that extremely helpful and crystal-clear tutorial!!

When adding an entry in OgreMax for each animation clip in the Trax Editor (see bold row in the quoted lines below) I cannot set the end-frame above 24, although my imported anim clip is 100 frames. No matter what I enter (above 24) it sets the end frame at 24! As you can imagine this can be rather limiting and also it spoils the --other than that-- perfect workflow!
Any idea why this is happening and how could I overcome it? Anybody else had the same problem?
MrFigaro wrote: + Add the animation entries to the mesh object OgreMax data.
+ Select the mesh.
+ OgreMax->Object Settings...
+ Select the Mesh Animations tab
+ Mesh Animation Type: Skeleton
+ Export Skeleton: Yes
+ Export Animations to Seperate Skeleton Files: FALSE
+ For each animation clip in the trax editor, press the Add... button
+ Set the name (e.g. Walk, Run)
+ Set the Start/End frames, as displayed in the Trax Editor for the clip (bottom left and right values)
Thanks again for the valuable contribution!
yannischris
Gnoblar
Posts: 11
Joined: Sat Jan 21, 2012 9:41 am

Re: Exporting animations using Maya and OgreMax

Post by yannischris »

I found the solution: You just need to set the start/end frames of the general timeline (the one at the bottom of the Maya GUI).