Autodesk’s® 3D Studio Max® Exporter and Bone Animation
By Ben “DigiBen” Humphrey
Scene Take From 3D
Studio Max®
* Six-Part
Tutorial Series Intro *
This document explains the six-part series of tutorials that show how to
write an exporter that exports animated and static models from Autodesk’s®
3D Studio Max®. The tutorial
series also shows how to load and render that data in a 3D application. There is a three-part series called the 3DS Exporter
and another three-part series that is called Bone Animation. These tutorials use our own format called
.GTF. Check below for the details of the
format.
* What is 3D
Studio Max®? *
Among other things, 3D Studio Max® is 3D editor that can create amazing 3D worlds and animation. This program is used by many game developers, as well as many of the animation we see in movies. Another popular 3D editor is Maya®. Our exporter is compiled with version 7 of 3D Studio Max®. You might need to recompile the exporter project for your own version of Max in case it won’t load with your version.
* What is an
Exporter? *
When we create our cool models and worlds in a 3D editor, we need to "export" that model data (vertices, texture coordinates, etc.) to a file that can be read into our own program. Since most file formats don't support bone animation, we need to create our own file format that stores that information. We do this by creating our own "exporter" that will spit out all the needed information into a file. We create a .GTF file format. The exporter is actually a DLL that is changed to a .DLE file and stored in the Plugins\ folder located in your 3D Studio Max® directory. When 3DS Max® loads it will check the plugins folder and load all the plugins. You can then choose the "File->Export" option, which will bring up file formats that you can export your data to. If your exporter is loaded its file format will be an option.
* The
Exporter is a DLL? *
Correct! We need to create a DLL project, not a console or Win32 application. If you are unsure how to create a DLL, please refer back to our DLL tutorial. Make sure you create the DLL with no added files to it, otherwise Visual Studio will add unneeded files and settings.
* Video
Tutorials Included *
Be sure to view our video tutorials that are included with this tutorial that shows you how to setup your project settings correctly, as well as using the plugin in 3DS Max. You can access these tutorials by clicking on the Exporter.htm file. Make sure you have the correct codec installed. You can find a link for the TechSmith codec at the bottom of the html page.
* MAX SDK is
Needed to Compile *
In order to compile a Max exporter you need to have the SDK for the current version of Max that you are running. You can download version 5.0 of the SDK online from Discreet's website. If you are running version 6.0 and up the
exporters should work for 6.0, 7.0 and 8.0. I am running version 7.0 for this tutorial.
* DEF File
Needed *
You will notice in the current project's folder there is a file called Exporter.def. This file is needed for Max to load our exporter. The file consists of the following:
LIBRARY Exporter
EXPORTS
LibDescription @1
LibNumberClasses @2
LibClassDesc @3
LibVersion @4
SECTIONS
.data READ WRITE
This just tells Max what we called our main class and the rest is just standard data that you won't need to change. This file needs to be in the directory when you compile the DLL.
* The .GTF
File Format *
Below is the basic file format we used for our .GTF format to store the model data:
* "GT3D" ( 4 characters )
* Exporter Version ( 1 float )
* Number of Objects/Meshes ( 1 int )
* Number of Materials ( 1 int )
* Material Name ( Number of Materials * char[MAX_FILE_NAME] )
* Number of Vertices ( 1 int )
* Vertices ( Number of Vertices * CVector3 )
* Number of Indices ( 1 int )
* Indices ( Number of Indices * int )
* Number of UV Coordinates ( 1 int )
* UV Coords ( Number of UV Coords * CVector3 )
* Number of Texture Indices ( 1 int )
* Texture Indices ( Number of Texture Indices * int )
* Has Skeletal Anim Bool ( 1 bool )
* Number of Weights ( 1 int )
* Weight Info ( Number of Weights * CVector2 )
* Frame Rate ( 1 int )
* Number of Frames ( 1 int )
* Translation ( 1 CVector3 )
* Quaternion ( 1 CVector4 )
* What is
Bone Animation? *
If you have never worked with bone animation, let's go over the basics of how it works. When creating a character, artists will usually make a character with their arms pointing outward. This is because it's easier to apply bones to the character that way. Usually the character is one or so objects, so in order to animate the object(s) you need bones that are attached to the model to influence the mesh. Once you attach the bones like a skeleton you can move the bones and they will move the vertices that are closest to the bone. It's like a puppet.
When exporting the bone animation data, you export a matrix for every bone and for every frame of the animation. We use quaternions so we export a separate translation position and the quaternion rotation.
* What is
Weighted Bone Animation? *
Weighted bone animation means that if you have a huge fat character, and you want his chubby stomach to bounce around to simulate realism, Max allows us to apply special weighting to different parts of the body. For every vertice there is a weight attached that influences it. If there are many different weights applied to the model, then all those weights are factored in as well.
* Which
Order Should I View the Tutorials? *
You want to start with the first three exporter tutorials, then move on to the three loader tutorials.
CONTROLS:
The controls for the loader are simple:
LEFT - Rotates the model to the left
RIGHT - Rotates the model to the right
W - Turns wire-frame on/off
ESC - Quits the program
©
2000-2006 GameTutorials