dev in the making

game development, maya and code by brainzizi

zAnimation – exporting models from Maya

leave a comment »

This is a short tutorial which I’m also posting on the zAnimation codeplex wiki. The next one should be about building a new project with zAnimation. This was going to be a video tutorial, but my english speaking abilities sock. As well as my english writing abilities. Also I suck at modeling/animating, so this shouldn’t be taken as a modeling tutorial. It’s a tutorial on how to export stuff.  So let’s get started.


  1. First a bit of back info. What’s our goal? To make some connected vertices that can be controlled by a number of joints. Each vertex has a List of values indicating how much a certain bone is affecting it. This is done by a technique called smooth skin binding. First make some geometry. It doesn’t matter if the geometry is a single big mesh or a number of smaller meshes. In the end they’re all vertices. I’ll be working with a very simple object and a very simple animation – a door which can open and close. Next is the joint placing. Next is skin binding. This connects the geometry to the joints, and is the backbone of this whole process. After that is weight painting – assigning values to vertices depending on how much do you want a bone to influence that single vertex. Next is animating or keyframing. Essentially remembering the posing of  bones at various times in our timeline. This is directly linked to the animations refresh rate. zAnimation requires special timeline format, but we’ll get to that. And the last step will be exporting, making sure that our data reaches XNA. Have fun!

  3. I’ll show you how to properly animate a model for export to XNA via zAnimation. Load up your model in Maya. I’m using Maya 2010, but an older version should work. I’m using a model with only 2 joints but models with more joints will work correctly as well.

  5. In case you have a skin already attached and weights painted, skip this step. Select your root joint and your geometry and go to Skin > Bind Skin > Smooth Bind (with options). Also make sure you’re in the animation mode. Setup your skin here including max influences, bind method and other options. When you’re done select your geometry and go to Skin > Edit Smooth Skin > Paint Skin Weights Tool (with options). Paint your bone weights here. Don’t miss a bone, because if a bone doesn’t have skin weights attached to at least a single vertice it will be ignored during the import into XNA, and all its children will be lost and you’ll get an error probably. So these are my weights.

  7. Try moving a joint now, see if your geometry is moving as expected. If that’s alright we can begin keyframing. Select all your joints by clicking on the root joint, right clicking and selecting “Select Hierarchy”. We have to key each joint on the first and the second frame in their original positions. This is called a bind pose, a reference to all future joint transformations. Place the timeline marker to the first frame, go to your “Channel Box” (shown in the image), select all the translation, rotation and scale values, right click and select “Key selected”. To this again but with the timeline marker on the second frame, and again at the fourth frame. In the third frame move all your joints a bit and keyframe them. You can skip this last step if you have a bigger animation moving ALL your joints. If a joint isn’t moved in the animation it will be ignored by the XNA FBX importer, and will probably generate an error. After this you can continue with your animation clips as desired (from frame 5 onward). I’ll make a simple open and close animations. Be aware that the default refresh rate is 60 frames per second and zAnimation will import animation at that frame rate, so time your animations properly.

  9. Bake your animation. Select all your joints by clicking the root joint and selecting “Select Hierarchy”, go to Edit > Keys > Bake Simulation (with options). Keep the default settings except start/end time and select “Driven channels” and remove “Keep unbaked keys”. Be sure to bake the entire animation timeline. This step is required because zAnimation doesn’t interpolate the joint transformations between the keyframes. Yet. Press Bake. After this is done, position your timeline marker at frame 1 and select you geometry. From there select Skin > Go to Bind Pose, and you’re ready for export.

  11. Export your geometry and joints by selecting all of them (the entire joint hierarchy) and selecting File > Export Selection. After picking the file name and path you’ll be greeted by the FBX export dialog. Be sure you have the newest Maya FBX exporter (I have FBX201000). The important things for zAnimation are “Animation”, “Deformed models” and “Skins”. You should select them all. Click Export, and you’re done!

This has been a fast rundown of how to export a model from Maya to XNA using zAnimation. In the next post I’ll be explaining how to create a new XNA game with zAnimation and playing an animation. Regarding IK handles, they don’t get exported so be sure to bake the animation to your joints. You don’t have to delete them they won’t interfere. Please post feedback if you encountered problems or if you just have something to say!


Written by brainzizizi

12.10.2009 at 12:57

Posted in xna

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: