animating 3d models

Started by
7 comments, last by sross 20 years, 10 months ago
Hi Ok I know basicly how 3d animation works... you have a hierarchy of bones that are dependant on there parent bones and so on... so when you move the parent bone... the child bones will follow... altho what im wondering about is suppose i code all the movements saying rotate left arm 5 degree at frame 1, etc and so on for all frames... wouldnt it look a bit robotic and would take a lot of test to get the anim to look good? Now we have a 3d animator who is with us on our project that is quite good at doing animation in 3ds max... would there be a way to export the mathematic transformation for each of the bones for each frame (or key frame) of an animation in 3ds max? (since i dont want to do kind of "3d sprite" animation cuz there will be lot of animations.) If you know about a program who does this or you have any other suggestion to solve this problem plz tell me EDIT: exporting the animation into vertex shader format would perhaps be even better Yann L PWNS Carmack [edited by - sross on June 18, 2003 9:10:32 AM]
Stéphane RossGame Gurus Entertainment
Advertisement
I'm going to take a "swing" at this, but I might miss. I haven't yet done 3D hierarchical animation yet myself, but here's one way to do it with 3DS max.

First, you need to make sure you name and group all of your animated parts in 3DS max. If you had a rebot model, for example, you would have groups named "l_upper_arm", "l_lower_arm", "l_hand", "r_upper_arm", "r_lower_arm", "r_hand", "l_upper_leg", etc...

Next you need to set up a series of keyframes for the model, and you need to group the keyframes into different "animation" sets. Here's what I mean. Assume that all walking animation will be contained between frames 1 and 100. All running animation should take place between frames 101 and 200. A left-arm "waving" animation will be between frames 201 and 250, and a right-arm "waving" animation animation will be between frames 251 and 300, and so on. So you basically need to decide which frame each animation will start and which frame that animation needs to be finished by.

Now let's say your 3D animator does the animation for the "walking animation" of the model. He makes a keyframe at frame 1 which is what the model should look like at the beginning of the frame. Then he adds several other keyframes (maybe one at 10, another at 20, 50, 75, and so on, as needed) and ends the animation by creating a final keyframe at 100. He moves the legs to different positions at each of the keyframes. The final keyframe shows the model at almost the exact same state as the first keyframe at frame 1. That way when you loop the animation, it will appear as if the model is walking continuously. Now note that the animator did NOT specifically animate the model for EACH frame. Instead, he just specified the scales, rotations, and translations of the body parts at keyframes in a few places. When you "preview" or "render" the animation in 3DS Max, what happens? Well 3DS Max starts the animation at frame 1 and positions the model parts to match what your animator specified at the starting keyframe. 3DS Max knows what the model rotations, translations, and scales should be at the next keyframe (specified at frame 10) but what happens if you're at frame 5? Well, you're halfway past your first keyframe, and halfway towards your next keyframe. 3DS Max interpolates the vertex positions between the 2 keyframes so that each vertex is at a "halfway" point between the 2 keyframes. At frame 12, 3DS Max will have to interpolate what the rotations and translations of each model piece will be at between keyframe 10 and keyframe 20. It should be closer to the rotations and translations of frame 10 than frame 20. Also note that the animator will specify bias, continuty (and something else?) for each keyframe. These values will effect how the animation should transition across the keyframe. For example, should the model part "snap" to the keyframe, or should it slow down as it nears the keyframe?

Okay, so how do you get this stuff working in your program, you ask? Well I can't help out too much here, as I've said, I haven't done this yet myself. But I do know that you have to read the keyframe data and perhaps do the same kind of interpolation in your program. I'd suggest reading up more on the 3DS file format to find out how this data is stored. I think there may also be some tutorials on how to do this.

The stuff that I described above is exactly how it works when you make a model for MS Flight Simulator 2002 using Discreet's GMAX (a specialized version of 3DS Max intended for the game industry). You give all the moveable surfaces on your plane model predefined "names" so that MS Flight Simulator will know how to animate the rudder, elevator, landing gear, and so on.

Hope this high-level overview helps!

[edited by - Expendable on June 18, 2003 2:11:13 PM]
E-x-p-e-n-d-a-b-l-e
yea well i already mostly know all of this (altho thx anyway for your time and will to help ) ... like you said, what i wanna know is how to export those transformation values at the keyframe so that i can interpolate the animation in my program with the framerate...

i read we can do this with MaxScript but i dunno how this work... anyone got tutorials on maxscript or already done a script that does this that could help me out?

Yann L PWNS Carmack

[edited by - sross on June 18, 2003 3:34:32 PM]
Stéphane RossGame Gurus Entertainment
That data should be there in the file.
E-x-p-e-n-d-a-b-l-e
in the .3ds file? or .max file? but even if its there... how do i get it from the file... or is there a way to convert it to a special format type? cuz i dont think you can store animation ( well the mathematic transformations over time) in .x files...

Yann L PWNS Carmack
Stéphane RossGame Gurus Entertainment
Of course you can export animation to .x files, even animation sets (more animations) and it''s basically just one matrix for each keyframe for each bone. If your animator makes animation with character studio, then the exporter from microsoft (provided together with DX SDK) will work fine. If he uses max bones (as I did) their exporter doesn''t help. For that I''ve written my own .x file exporter. Check it out here:
http://www.3dlevel.com/flamer/presentation/scripts.html
(don''t mind other stuff at this page, it was made for a competition entry)

Our physics engine demonstration uses files exported with above mentioned script, so if you need an example you can dl the demo here:
http://www.3dlevel.com/ardemo.php
School TournamentThis game is going to kisk some teacher ass!More on: www.3dlevel.com
wow this script is nice, i tested it with your stickman model and looked at the .x file generated in notepad. all i need is there. Altho i saw that you put 2 animation in the same .x files, since im not really use to .x files with animation, have you some links or tutorial about playing animation from .x files (like how to start/stop them and how to choose which anim to play)? or some source code to give me?

I loaded your .x model in the directx mesh viewer and only the idle anim was playing so i guess you have to add some manipualtion code to fire off the animation you want and when...

also i saw you put framerate at 30 or something like that in the beginning of the file... if in the game there are more then 30 fps will the anim will automatically synchrozie with the game''s framerate or it will run faster?

thx a lot for your help

Yann L PWNS Carmack
Stéphane RossGame Gurus Entertainment
In MeshViewer go to Animation>animations and you can choose which animation to play. The different animations are exported using special info provided in the note track of the model (use max help to find about how to access it). Usually the frame 0 contains the model in the basic form (arms and legs apart and all... ) and the next frames are used for different animations.

The framerate is used because you need to tell the indexes of frames where the keyframes are positioned so you don''t tell in seconds for instance. This means that it''s just calculated to seconds when you load it so everything animates smoothly (and with proper speed) even at 200FPS.

As for how to load the X files, use skinned mesh sample provided with DX SDK. It should include all calls you need to play/stop an animation.
School TournamentThis game is going to kisk some teacher ass!More on: www.3dlevel.com
ok thx ill check that out

Yann L PWNS Carmack
Stéphane RossGame Gurus Entertainment

This topic is closed to new replies.

Advertisement