 |
Exporting Avatars from 3D Studio Max
From RexWiki
Instructions on how to export animated avatars for use with realXtend, using 3D Studio Max.
The basic principles are also useful with other modelling tools such as Blender; you should have an exporter that is able to produce animated Ogre mesh & skeleton files.
Prerequisites
- Get realXtend Export Tools 0.3 from http://www.realxtend.org/page.php?pg=downloads
- Extract the tools package to a temporary directory on your hard disk.
- Follow the instructions in the file "Tool installation and use.txt" to set up the Ogre Maxscript based exporter (MaxScriptExport) and RexMeshTool.
- After this, you should be able to execute the following programs/batch files from the command prompt: (if not, doublecheck that you added RexMeshTool's directory to the PATH enviroment variable; Control Panel -> System -> Advanced -> Enviroment Variables)
- rexmeshtool.exe
- ogrexmlconverter.exe
- xml2mesh.bat
- You should also be able to bring up the Ogre exporter in 3DS Max. (if creating an icon for it doesn't work, creating a key shortcut for it in Customize/Customize User Interface should be easier)
Exporting the mesh, skeleton & material
- Now load your avatar 3D model in Max. It should have at most 2 materials; the first for the body texture and second for the head texture. Just 1 material for the whole avatar is also fine.
- If your avatar is skeletally animated, it should be set to its base "idle" pose for now (if you have different animations/poses in different Max files, load the one with the idle pose). Also note that skinning has been extensively tested only with the Skin modifier.
- For head tracking to work (biped avatars only), the avatar should have a Biped skeleton with bones named Bip01, Bip01_Head etc.
- You should also have an empty directory for exporting, let's assume for example D:\RexExport
- Select your avatar model, and bring up the Ogre exporter. Choose destination directory & filename for the exporting (no file extension needed). For purposes of this tutorial we're using the example name YourAvatar
- See that the Export Mesh, Export Skeleton & Export Material checkboxes are all enabled. Do not add any animations yet into the Skeleton panel. Then press the "Export !" button.
- If there were problems, refer to MaxScriptExport's documentation. For now, let's assume exporting all of the mesh, skeleton & material were successful.
- Open a command prompt and go to the export directory. There should be YourAvatar.mesh.xml & YourAvatar.skeleton.xml -files, and the YourAvatar.material -file.
- Open the .material file, and check that the material names are somewhat sane. If not, change them BOTH from YourAvatar.mesh.xml and the material file (the names must match or else the materials won't be displayed correctly)
- Copy any texture images you need to the export directory. See that the filenames match those defined in the .material file.
- Now run xml2mesh to produce the actual binary Ogre .mesh & .skeleton files that can be used by realXtend:
xml2mesh YourAvatar
- Open the avatar mesh with RexMeshTool to see that it looks OK. Do not apply any scaling/rotating yet; scroll with the mouse wheel if the model is too large!
rexmeshtool YourAvatar.mesh
- If the model looks too dark, you can try removing the diffuse/ambient etc. definitions from the material file, and leaving just the texture image definition.
Exporting animations
- Now load the Max file with the animation(s) you want to export for your avatar.
- Again, select the avatar model and bring up the Ogre exporter. This time, uncheck "Export Mesh" & "Export Material" checkboxes, and make sure only "Export Skeleton" is checked.
- Choose the same export directory, but a different file name this time. For example YourAvatar_Walk for the walk animation.
- Into the Skeleton panel, input the frame range of your animation, its name and length (set length 0 for the Ogre exporter to calculate it automatically based on your Max system framerate). Then click Add. If you have several animations defined on the timeline, repeat for each of them.
- By using the realXtend avatar definition .xml file (referenced later) animations can have any names. But it's good to stick to the default naming convention that's used for the Jack (default) avatar:
Walk - walking
Stand - idle (breathing etc.)
Crouch - crouch walking
Run - running
Hover - hovering while in Fly mode & not moving
Fly - actual flying animation
(for the complete list of animations, you can open Jack.mesh from realXtend viewer's media\models\avatar directory in RexMeshTool), or look into the definitions in app_settings\ogre_avatar_animations.xml
- When all animations from this Max file have been added, click "Export !"
- In the command prompt, run xml2mesh again to convert the .skeleton.xml file you just produced into a binary .skeleton file. Do not mind the error message caused by the missing mesh file (as we exported only a skeleton this time). For example:
xml2mesh YourAvatar_Walk
- If you have more Max files with different animations, repeat from beginning of step 9.3 for all of them (choose a different export filename each time).
Merging animations
- When all animations are ready in their respective .skeleton files, it's time to merge the animations into the original YourAvatar.skeleton file.
- Open YourAvatar.mesh with RexMeshTool again:
rexmeshtool YourAvatar.mesh
- Do not touch the scale/rotate controls yet either; scroll with the mouse wheel to zoom away if the avatar's too large!
- Instead, click the "Merge anims from skeleton" -button. A file selection dialog appears where you should be able to select any of the extra skeletons you produced, like YourAvatar_Walk.skeleton
- After merging each extra skeleton, check the Animation combobox that the new animation(s) appear correct.
- After all skeletons have been merged, click "Save changes & exit".
Finalizing the avatar
- Now open YourAvatar.mesh with RexMeshTool one more time.
- Use the X/Y/Z Rotate controls to ensure the avatar is upright and has its back turned to you.
- Use the Scale or Size controls to set a sensible size for the avatar. Remember that realXtend coordinate unit = 1 metre inworld. When you find a good size, save the "scale" value for later reference.
- Use the X/Y/Z Align controls to set the mesh pivot point to its bottom center point (typically at the feet for biped characters). Note: if the pivot point is already OK, leave the X/Y/Z Align controls empty or to the None-setting.
- Refer to the existing avatar meshes in realXtend viewer's media\models\avatar as necessary.
Copying files
- To be able to use the mesh in realXtend viewer & Avatar Generator, the files need to be placed into the correct directories within the viewer installation:
YourAvatar.mesh & YourAvatar.skeleton into media\models\avatar
YourAvatar.material into media\materials\scripts
Body textures into media\materials\textures\avatar_body
Face textures into media\materials\textures\avatar_face
Avatar description .xml file
The .xml file for the avatar, for example Jack.xml for Jack.mesh, determines the animations, modifier controls in Avatar Generator and other extended features. For descriptions of the parameters, see Avatar Description File Parameters
|
 |