attaching and exporting animation (bones) in Max

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

attaching and exporting animation (bones) in Max

Post by krazyscotsman »

I got a few questions maybe someone can help me with. My A-10 is nearly completed with animation. This is the method I used to rig the bones: I attached the bones to each individual mesh (example: bone 1 attached to tail using skin modifier and bone 2 attached to rudder using skin modifier). I then set the animation for movement of the rudder by rotating the bone. I did this for the entire model. This is what I'm not sure about. If I collapse the stack that the skin modifier is in, it loose the ability to minpulate the the rudder (when I collapse the rudder stack the rudder is no longer animated). Also, when I attach all the parts (bones, rudder to tail, tail to fuse, etc, etc) the parts are no longer animated. What am I doing wrong? Do I need to collapse the components with animation? Do I attach the components to the bones (rudder attaches to bone 2 as in example)? I guess I'm not sure how to get the animation ready for export. Whenever I try to collapse and/or attach the components, the animation no longer works. Any suggestions or tutorials for this?

Thanks,
Krazyscotsman
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

I am not sure what 3D packages you are using, but I will assume you are using 3DSMAX. When you want your model to be ready for export of mesh and animation, you need to know 2 things:

1. You can have only 1 mesh to exported. If you have more than one, just attach all of them together.

2. You can have only one single parent to be exported. If you have more than one, just create another Node, like Dummy, and attach all the parent bones to that dummy.

For the process of setting up your model and bones for exporting, take a look the steps below:

1. Assuming that you have a model with UV coordinates ready, you need to reset X-form to your model. This will mean to have your translation, and rotation set to 0,0,0. Your scale is to be 100 in all axis.

There is a technic to do this, additionally to the reset X-form way. Create a box at 0,0,0. (Size doesn't matter.) Convert it to Editable mesh. While selecting your box mesh, attach your model to it. Delete your box and then your model should have a brand new transformation.

2. Set your bones to fit with your model. Also you are supposed to know how to set up bones at this stage. Be noticed that you should have only one single parent bone. See your schematic view, it should show you only one root bone. Otherwise, the exporter won't work it out.

3. Skining your model with your bones. All the bones in your scene should be added to your skin list. No one left unskined.

4. Select your exporter, choose your mesh. Then your model and bones should be ready for exporting.

Any questions are more than welcome.

Semicolon

P.S. You should have your skin modifier on the stack of your model. Do not collapse it. This will clean up the deformation.
"Nature is the mother of learning"
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

Post by krazyscotsman »

Yes, I am using 3ds max. I'm not sure I completely understand. Should I have attached the pieces into one mesh before I started using bones? From tutorials I have read, all different pieces of the model (A-10 in this case) was seperate meshes (fuse., tail, rudder, etc). Then the bones linked the models together. For example the wheel is skinned to bone 2 and the landing gear is skinned to bone 1. The joint between 2 and 1 is the point of rotation. Am I wrong? I used multiple bones root and bones to attach the various components of the meshes. For example bone 1 and 2 are skinned to the left rudder and tail. Bones 3 and 4 are skinned to the right rudder and tail. Is this correct? Maybe I am not entirely understanding the root part of this. When you said, I can only have one parent to export, do you mean I can not have more than 1 parent bone? If this is the case, should I create a dummy and attach to the dummy node? How will this effect the animation? Will this change the animation? Also, when I attach all the meshes, do I attach bones as well? And once I attack the meshes will the animated pieces go away? What I have now is several pieces (meshes) of the model not attached to anything but skinned (modifier) to the correct bone to provide animation. When I attach all the pieces to 1 mesh, do I need to add all the bones under the skin modifier (so A-10 mesh *the single mesh* has 38 bones under teh skin modifier)? Before I began adding bones to the model, I did reset x-form on the model. Sorry for so many questions, I am truly new add exporting animation for OGRE. I just recently got exporting static meshes.

Again, I'm sorry for these very basic questions. I have only been using bones for about 2 weeks or so.

Krazyscotsman
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

:oops: Sorry for my bad English. I am not so good in English yet. By the way, I am trying to answer all the questions you have. Don't worry about asking what you are not clear to me. I am eagerly to help.

Ok. Let's try again. (As far as I've been experimenting Exporter, These are what I've got.)

1. You can have only one mesh in your scene. As you said, yes, you should attach all the meshes together to become one single mesh. The material assigned to this mesh should be "Multi-subobject" to be able to export the material, if you want to have have more than one material.

2. You should have only one single bone root. Two bone roots won't work. If you have more than one you may create any kind of objects like dummy. Link all the bone roots to this dummy as its children, so that it will be the one single bone root.

Please understand that bones can be anything under the hierachy. You can use a hierachy of boxes as skeletons. Same as dummy object or point. So dummy mixed with bones won't ruin your animation.

3. No, You shouldn't attach your bones to your mesh. Just add them to the "skin list". And be careful, you should attach all the bones in your scene to your "skin list". To ensure this, you may look into your schematic view.

Try again. This is not too hard if you can pass the first step.

Semicolon
"Nature is the mother of learning"
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

Post by krazyscotsman »

Thank you. Your English is much better than my Thai :D ! I truly appreciate your time. I think I understand everything. I will try again. Should the bones still move the mesh (animate) once they are all attached?

Thanks,
Krazyscotsman
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

Post by krazyscotsman »

I've tried following your instructions or at least I think so. And I'm not sure what is wrong. I receive the following error message in the pop-up windows: " -- Type error: Call needs function or class, got: undefined." Click OK. In the bottom left corner in Max, I have "Max rollout handler exception."

This is what I did as far as fixing the model for export. I attached all meshes but left the bones unattached (using the attach tool for meshes). Then I added all the bones to the skin modifier applied to the attached meshes (bones 1 through 34). I linked the root bones or at least I think so to a dummy using the link tool. Then I tried to export it by clicking the OGRE exporter, check marked export mesh and export skeleton (I left export biped uncheck marked). Finally, I gave it a name for the exported model and named the animation. The following contents is how my schematic view appears:

A10beta2
Dummy01
bone01
bone02
bone03
bone04
and this continues to bone 34
IK chain01
IK chain02
IK chain continues through 16 under dummy01 indented only once.
Bone01 is indented under Dummy01 and bone02 is indented past bone01. and the chain continues this pattern

could you please provide some more help.

Thanks,
Krazyscotsman
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Hmm... I forgot to tell you another thing. Please do not add the IK chain to your skin list. Be careful of this, Orge does support FK animation but not IK animation. All the animation you want to be exported must have keyframes. Otherwise exporter won't recognize it as bones.

Here is a trick to use IK for Orge:
1. You may use IK bones with IK chain if you want. But all the bones you animate must have keyframes.
2. Use 3DSMAX 6, Once you set your IK bones. Switch the IK to FK mode. Select the bone handle and animate it just like IK.
3. Once you've done your animation, delete the IK chain. Then the keyframes will be added to every single bones correctly. This way will help you animate with IK but get the keyframes just like FK.

However, I still don't have an idea what's wrong with that yet. Don't be hesitate to ask my help. I'll keep watching on you until you succeed.

Semicolon
"Nature is the mother of learning"
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

Post by krazyscotsman »

I'm back again with another problem or the same problem. I thought the animation file had exported successfully. However, I think I was wrong. When I began animating the model, I did so without the model being attached into a single mesh. Then after I had the animation correct with the various other meshes, I attached them into one mesh. With Semicolon's help, I was able to finally get the model and skeleton to export; however, it doesn't seem to have any movement in the mesh viewer. Nor does the model have any movement in 3ds max once the individual meshes are attached.

Here is a copy of the exported meshes, would it be possible for someone to take a look and see if the files are correct or if I did something wrong.

http://www.phoenixosfs.org/scotsman/A10/a10beta2.zip

Thanks,

Krazyscotsman
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Hi krazyscotsman:

I opened your .xml file. All the keyframes don't have information. As far as I could figure it out, here are some points:

1. Orge does support only FK. It means you shouldn't use IK solver for your animation.

2. Each keyframes need Position and Rotation information. Otherwise your animation might not work correct or so.

3. Each animation need to have at least keyframes at the beginning and at the end.

I need to see your max file to really know what happens. However try to see the Orge manual about skeleton and animation. It contains some functions and limitations that should realize. Any questions are very welcome.

Semicolon
"Nature is the mother of learning"
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

Post by krazyscotsman »

Before the model was attached, the key frames were set up... when I attached everything, the key frames disappeared. Here is the link to the .max files. One file is an attached ready to export to OGRE and the other is before attaching.

http://www.phoenixosfs.org/scotsman/A10 ... xfiles.zip

Thanks for any input on the problem.

Krazyscotsman
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

I have an other (or even similar) problem here (3ds max 6).

You said that I can put every object (boxes, dummies, points etc.) into the skin list (skin modifier) and the Ogre Exporter will export it correctly.

I tried this but the hierarchy was not exported although I linked everything and the hierarchy exists in the 3ds max Schematic View.

This is the hierarchy in the exported xml skeleton file:

<bonehierarchy>
<boneparent bone="zzwxy" parent="Dummy01" />
</bonehierarchy>


I need to export the hierarchy correctly using any other object but no bones. This is necessary to use facial setups and exported char-rigs with fbx and imported them with fbx (there will be no bone objects after importing, only animated standard max-objects/editable meshes).

So I'm searching for a plugin or a script which can convert standard max-objects/editable meshes into bone objects! Or is there a way to export the hierarchy with the Ogre Exporter correctly?

I hope you can help.

Sorry for my bad English.
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

I have the solution for you, guys!!! :) :) :)

The keyword is "bone on" in the bone tools! I tried it before, but in the wrong order!
You have to activate the option "bone on" for every skinned object BEFORE you export everything to fbx! After importing this fbx-file, you'll get real bones! This can properly be exported with the Ogre Exporter and all the hierarchy is correctly listed in the xml!
Juhuu! :D
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Oh that's very great trick to know.

By the way, How could I do that again activate the "bone on"? I haven't seen that before. So could you please explain some more details.

Thanks a lot for the solution.

Semicolon
"Nature is the mother of learning"
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Hi again Krazyscotman:

I fixed your mesh and ready to export now but I still have some problem exporting the mesh with a lot of polygons. The exporter script said "out of scripter memory." Do you know to change the memory size?

Semicolon
"Nature is the mother of learning"
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Hi again (again) Krazyscotman:

I have fixed your file and here is the file. Sorry that I couldn't export the mesh since it said "out of scripter memory" and I didn't know how to fix this.

http://www.handy-arts.com/Documents/A10.rar

Semicolon
"Nature is the mother of learning"
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

@ semicolon

hm what do you mean with "How could I do that again"?
i'll just explain it once more:
you can give any object the behavement of a bone when you activate the option "bone on" in the bone tools. but this activation does NOT convert an object to a bone. fbx helps here. you can export all your objects (which have "bone on") to fbx and import this fbx-file again. you will get real bones then, which can be properly exported with ogre.
a quite important thing before exporting to fbx is also to create a character within max (select all objects and mesh, then go to main menu->character->create character)! this keeps the base positions and rotations clean so that you'll get exactly the same pose when importing your fbx-file. if the character/objects move when creating a character, make sure to transform the position of the character-icon to 0;0;0.

happy exporting! :D
Anveo
Gnoblar
Posts: 6
Joined: Thu Mar 13, 2003 9:05 pm
Contact:

Post by Anveo »

semicolon wrote:Hi again Krazyscotman:

I fixed your mesh and ready to export now but I still have some problem exporting the mesh with a lot of polygons. The exporter script said "out of scripter memory." Do you know to change the memory size?

Semicolon
Customize->Preferences->MAXScript and then increase the value in the memory heap input box(mine is at 128). Then restart MAX and it should work.
krazyscotsman
Gnoblar
Posts: 17
Joined: Thu Aug 21, 2003 7:17 pm
Location: San Diego, CA
Contact:

Post by krazyscotsman »

Semicolon - thanks for the help. Here's my question for you. At what point did you attach the mesh? Did you animate with bones and then attach? Or attach mesh and then animate with bones? When you fixed the normals on the model, how did you test for these to know to flip them? Finally, would it be possible to fix my current model without deleting all the bones? I hate the thought of starting all over - lot of time invested :( . But if need be, that's what I'll do .

Semicolon - you can find the bones tools by customizing user interface and picking or adding character. This will give you the option for bone on.

Grack - By using "Bone On" you can animate the individual meshes oppose to animating the bones? Then when you import the fbx file, it will place the bones correctly to create the animation? If so, do you attach all meshes after you import the fbx file or before exporting?

Thanks everyone for all the help and suggestions :)

Krazyscotsman
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

hm I think the meshes should always be attached. but I am not sure.
So far I tried it only with characters (one single mesh).

and yes, as i said before, fbx will create bones with any object which have "bone on" activated.
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Hello everyone:

Thanks Anveo for helping me with the scripter memory and Grack for the nice trick of the bone box animation.

Ok. Please let me explain the process since the beginning to the end of exporting some mesh with animation.

1. Modeling: Create your character and fix the normal. (normal of the polygon. If it goes to the other direction, that polygon will be invisible.)

2. UVs: Assign UVs to your character so you can create texture for it.

3. Create material and texture: If you want to be able to export all the shader information to Orge material script, you should use "Orge material." Put the texture into the material, fix the shader color or so to make your model look nice. :D

4. Additional Fix for exporting: Your model should face towards Y-axis. If not, rotate it to face that direction.

5. Reset the model transformation: This will help especially to make all the scale and rotation to 100,100,100 and 0,0,0 respectively. Otherwise the scale and rotation in Orge might not be correctly.

6. Set up bones for the model: Create bone structure. Or you can use biped as well.

7. Skin the model: Put skin modifier to your model. Add all the bones to the skin list. Assign vertex weight to each link (bones.) (Anything under the hierarchy of the bone structure except IK chains. If you use Biped, should not add biped footstep and all the node with the suffix of "Nub".)

8. Animate the model: At this step you don't need to tough your model anymore. To move, rotate or even scale can be done through the bones that you set. (All the constraints about animation for exporting to Orge are explained above.)

Krazyscotman:
1. Attach all the mesh first. Animate bones after you finish rigging the model.

2. You don't need to delete the bones that you've animated. Just put the new skin modifier to your mesh and set the weight.

Thanks for any suggestions. I get many tricks from this thread.

Semicolon
"Nature is the mother of learning"
User avatar
kfoong
Gnoblar
Posts: 7
Joined: Mon Jan 19, 2004 12:50 am
Location: Sydney, Australia
Contact:

Post by kfoong »

Hey all, I also have troubles with the exporting of 3DSmax bones. I get this error when I try to only export the skeleton: "-- Unknown property: "name" in undefined" I have no idea what this means.

It is also selected on this in the Maxscript "format("\t\t<bone id=\"%\" name=\"%\">\n") id (replaceSpaces d.name) to:outFile ;"
- Keen
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Hi kfoong:

I am not sure about that either. If you don't mind please let me see the max file.

Semicolon
"Nature is the mother of learning"
User avatar
sphinkie
Greenskin
Posts: 114
Joined: Wed Jul 07, 2004 11:08 am
Location: Paris
x 1
Contact:

Post by sphinkie »

kfong: the name problem means you have either ti define a material for your mesh, either unchec the option "export texture information" inthe exporter.
User avatar
sphinkie
Greenskin
Posts: 114
Joined: Wed Jul 07, 2004 11:08 am
Location: Paris
x 1
Contact:

Post by sphinkie »

kfong: this append also if you have no bone defined in your skeleton.
User avatar
RyanN
Halfling
Posts: 82
Joined: Thu Aug 19, 2004 6:41 am
Location: Victoria, Australia
Contact:

Post by RyanN »

I dont think the 3dsmax exporter likes "Dummys".
I've tried to rig a model using BIPED with extra bones attached to a dummy which is attached to the head, the exporter stop just before the dummy part was about to be exported. So im guessing it doesn't like the heirachy to go through helpers.

I've also rigged up a vehicle (a rover to be exact) and the way i read (an article on rigging up cars for games) is that it has to be all one mesh (including wheels, doors etc) and setup just like a character.
A show i saw, (something on making Flight sims) showed a plane setup as a character, the animation in max played through all the planes range of motion (rudders, canopy opening, etc.) then it would be up to the programmer to extract these animating bones and dynamicly control them in real-time like you do in Flight sim games.
Post Reply