Multiple animation on one mesh using .x file?

Started by
7 comments, last by Cypher19 20 years, 3 months ago
I'm currently in the planning stages of a 3D game I'm making, and one thing I'm wondering about is how can I have a mesh, and be able to store different animations for it, to be executed at different times? I.e. the unit will have the same model, but perform an idle animation, then switch to walking, then to attacking. It doesn't seem that a .x file can support this, so I'm wondering how I could do it. [edited by - cypher19 on January 3, 2004 6:03:18 PM]
Advertisement
Hey Cypher,

The .x file format does support what your after.

What you do when animating is keep note of the time frame over which your animations occur.

For example, you might have your idle animation going from frame 2 to frame 20. Then you would have your walking animation going from frame 21 to 40.

Now when programming your game, if your character is standing still you tell it to loop through frames 2 to 20. Then when s/he starts walking you tell it to loop frames 21 to 40.

It's the same for all your other animations.

Hope this helps
Khaine

p.s. Good design practice to work out what frames you want for each animation, and then apply that to every character. That way, no matter what character is currently in "focus" and is walking, you can say to use frames 21 to 40. Instead of having to remember where each animation is for each character.

p.p.s. All of this information, the mesh and all the animations, are all stored in the one .x file.

[edited by - Khaine on January 3, 2004 6:20:01 PM]
Khaine is correct, .X files do support animation, but it is neither easy to implement nor very accessible. I would look into the MD2 or MD3 format - they are not as popular (as in they don''t come up as much on this board), but it is much easier to do animation with them, I believe.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Khaine: How would I control what keyframes are played?
Edit: never mind, I just went through the DX9 SDK skinned mesh example and discovered the animation controller.

CircleSoft: I'll give MD3s a look. There's documentation of them on gamedev.net, right?

[edited by - cypher19 on January 3, 2004 8:53:44 PM]
I believe so. If not there is a tutorial on GameTutorials in the OGL section that covers animated MD3''s. I was going to convert it to DirectX, but I never quite got around to it.

Also, in the recent article on vertex tweening here on GD, an MD2 loader was included in the demo, and I have found that it is much simpler than any of the MD3 loaders out there.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Cypher19 - Have you looked in to getting the book Advanced Animation with DirectX by Jim Adams. It gives great information on the X file format. I believe it covers what you are asking.

This is precisely what microsoft need to look at. Cypher19, that''s got to be the crudest method of storing animations ever. Every time you change an anim''s length you''d have to change all the following animations. The way it should work is that you have a model file, this has the model in a restpose with the bone heirachy. The animation files should then be loaded and the animation applied to the model files bone heirachy. Each animation would have a separate file so that it can be edited independantly of any other.

The x file format is not the problem, it''s directx implementation of animation that''s the problem. It''s hideously over complicated and the semantics used are not the same as those used in animation but microsofts some-what anal over technical naming conventions.

Down with miscrosoft!!!!

Tee hee hee
Okay, in response to MD3''s:
There is the book "Focus on 3D Models" that covers them quite well, the only problem being that its in OGL not DX (it also covers MD2 and other formats).
Then, if they ever update it, this site could one day be of help - http://www.xbdev.net/3dformats/. (This does have MD2 for DX.)
Just a personal opinion, but after considering MD3''s for a while, I decided not to go with it. I dont really like the idea of needing to split all my models into 3 parts. While it would work for some games, it just wouldnt work for the kind of game im making.

In response to __Daedalus__: I also have that book. While I havent looked at it in detail yet, it does look really good. Skeletal animation, morphing, cloth animation, animated textures, and my favourite - ragdoll animation. All with the .x file format!
Just while I''m talking about books, I dont know what type of game your wanting to make, but if its an RPG I would highly recommend "Programming Role Playing Games with DIrect X". Its wriiten by the same guy who wrote "Advanced animation with Direct X".

I''ll probably get flamed for suggesting it, but I think the book ROCKS!

This topic is closed to new replies.

Advertisement