Milkshape 3D Animation

Started by
9 comments, last by Uthman 18 years, 6 months ago
I'm writing a Milkshape 3D .ms3d file loader but am having problems with the skeletal animation. Since the Milkshape format can only hold a single animation, I came up with a simple solution...to specify the starting and ending frames for each seperate animation that I want so my engine knows which frames are for which animation. This information is provided to my engine via a simple script file that contains the number of seperate animtions I want, and the starting and ending frames for each animation. But, I just learned that in Milkshape, not all the frames of animation are necessarily keyframes. I checked this in my code by examining the number of frames and the number of keyframes, and yep, they were different. I have 119 frames, but only 86 keyframes (for my particular model). So, obviously, I'm not getting correct results. The problem is, I'm specifying the frames of animation to the engine (out of the 119 frames of the model: 0-36 for animation 1, 37-96 for animation 2, and 97-119 for animation 3)...but the loader only loads 86 keyframes so things get screwed up. How can I get around this? Thanks for your time, any help is appreciated. Julien. PS: I've made the word 'keyframe' bold because I want to emphasize that it's different than a 'frame'.
Advertisement
I know that with the Milkshape format if after a certain keyframe if the joint does not move, it does not store a value for the next keyframe.

For instance if your model is moving its arm all the way up until frame 10, but from frame 10 to frame 20 does not move its arm again, then for the joints in the arm no keyframes are stored from 11-20.

Each keyframe in the file stores a 'time' stamp value. So you should be able to figure out which frame the keyframe for that joint applies to.
Author Freeworld3Dhttp://www.freeworld3d.org
Thank you very much that helps me a lot. But I'm not too sure how I can find a keyframe given a frame. Eg: Say my walking animation starts on frame 37, how would I know what keyframe this is? I've been thinking hard but I can't figure it out.
The MsViewer on Milkshape 3d download page contains all the needed source code to load a ms3d ascii file - including the animations. The ascii format and the binary one are basically the same thing so I guess you'll find some helpfull information inside.

HTH,
Thanks Emmanuel, but I've already checked out that source and I'm afraid it doesn't help me. I can load the model and animations just fine, but it's seperating the animations that is my problem (MsViewer doesn't show how to seperate the animations). All I need to do now is figure out what keyframe a given frame is. Like I said before, if I want to start animating from frame 37, then how can I calculate which keyframe this is?

Regards,
Julien.
Why not just put the animations in different files? You could write a little test to check the skeletons match, and if they do then animations can be used on the same skeleton. It means having multiple copies of the verts etc, but if space is a problem you can always create your own custom format later.

edit: actually, there's nothing to stop you removing the unnessesary data from the extra ms3d files and just having the skeleton and animation data.
[size="1"]
Well I've managed to figure it out, it was quite simple actually.

mrbastard: Thanks, that's a good idea. I might try it out sometime.
Good news - I'd like to know how you do it, if you don't mind [wink]
Milkshape is can be very helpful with simple character animation, however alot more people prefer blender or more commercial products like maya and max when it comes more complex animations.

BTW does anyone have any sites that has a tutorial for milkshape. I have a used quite a few in order to learn milkshape.
You fight like a cow
Quote:Original post by Emmanuel Deloget
Good news - I'd like to know how you do it, if you don't mind [wink]

Well to find the starting keyframe I looped through each keyframe until I found the keyframe with the same time as my starting time for that animation. That probably doesn't make any sense, if you want me to clarify anything just ask.

Regards,
Julien.

This topic is closed to new replies.

Advertisement