Sign in to follow this  
Chacha

Milkshape 3D Animation

Recommended Posts

Chacha    138
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'.

Share this post


Link to post
Share on other sites
soconne    105
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.

Share this post


Link to post
Share on other sites
Chacha    138
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.

Share this post


Link to post
Share on other sites
Chacha    138
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.

Share this post


Link to post
Share on other sites
mrbastard    1577
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.

Share this post


Link to post
Share on other sites
Chacha    138
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.

Share this post


Link to post
Share on other sites
Hodge    106
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.

Share this post


Link to post
Share on other sites
Chacha    138
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.

Share this post


Link to post
Share on other sites
Uthman    485
Brett Porter has released source code which does exactly what you are trying to. You can google for his name; he also has a (dated) tutorial on NeHe as well as a site hosted on GameDev. If you cannot find a working link to current source, pm me and I will email it to you.

----
edit

nevermind, looks like you got it, lol. next time ill read the entire reply's before posting =/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this