Sign in to follow this  
Teleruin

What is the best way of storing animations?

Recommended Posts

I'm curently working on a 3D Strategy/RG game whit Direct 3D, and have some questions. I tried the search function, but it did'nt work, so I hope these questions is not answered 1000 times before in here. I have made an MaxScript, to extract the information from 3dstudio, and save the vertex and frame information in my own made filetypes. This is done by storing the Position and Mapping coordinates for every vertex in every frame. It's also stored this way in my InGame class, because I was thinking that would be the fastest way to draw the units, since no vertexcalculation was needed other the setWorldTransform call although It sure uses a lot more memory. Is this a good decition? Or should I make a skinned/bone system thing. Is it much more time consuming to Render? I guess there would be possible to create som kind of optimation on the meshes If I use skinn and bones, but since I'm not using the X file format i dont know exactly how to do this. Does anyone now of some documentation for this, or can explain it ? The last thing I currently is wondering is: My map consists of a grid of rectangles, and is drawn in one call since that is the fastest. Is it possible to give the nearest faces a more detailed texture then the ones farther away, and still draw all the faces in one call? - Teleruin [Edited by - Teleruin on December 6, 2004 3:17:08 AM]

Share this post


Link to post
Share on other sites
Here are some current screensshorts of the game by the way :

http://illumination.moringen.no/rune/Bilder/AKScreenshots/fireballs.jpg

http://illumination.moringen.no/rune/Bilder/AKScreenshots/knights.jpg

http://illumination.moringen.no/rune/Bilder/AKScreenshots/Village.jpg

Share this post


Link to post
Share on other sites
The type of animation that is best for you depends on a lot of things:

(a) How many characters are animated?
(b) How long are the animation sequences?
(c) How many vertices do these characters have?

If you answer with high numbers to these questions, skeletal animation is preferable for you, from a developers standpoint. From an artists standpoint, skeletal animation for characters is almost always easier and faster. If you want to go the skeletal route, you my as well just design your own format from the get-go, instead of using X (it's just so unflexible, and nobody really gets it to work). Also, you could use a 3rd party format.

However, keyframe animation (that's what you're doing now) is much easier than skeletal animation. It requires *much* less programming to develop it, since it is much simpler in nature. Basically, what it boils down to is your choice. If you are having problems with memory use, you probably should look into using skeletal animation. If not, just stick with keyframe, since you already have it working [smile].

Share this post


Link to post
Share on other sites
Quote:
However, keyframe animation (that's what you're doing now) is much easier than skeletal animation. It requires *much* less programming to develop it, since it is much simpler in nature. Basically, what it boils down to is your choice. If you are having problems with memory use, you probably should look into using skeletal animation. If not, just stick with keyframe, since you already have it working


Actually I dont think I even got keyframe animation. Or if I have then every single frame in the whole animation is a keyframe, and is stored both in the files and in memory. There is no calculation for inBetween-frames.
Currently I don't have memoryissues whit this, but Im also currently just use one type of unit.

I would like to have many types of units, and maybe even the possibillety to have different versions of the models. like (holding a sword, holding an axe, and so on). Therefor I think I should go over to either keyframe og skinned mesh.
I could of cause also use the sword and axe as their own models, but I cant see how I could use the same swordmodel and animation on units of different sizes and whit different attackanimations.

I'm working on making the meshes progressive ringht now, so that probably means that even more memory is required pr vertex.

Share this post


Link to post
Share on other sites
Keyframe animation is defined as interpolating between different sets of vertices, based on the current time. That is what you are doing (except that you aren't really interpolating - you just jump from frame to frame without anything in-between). Here is a really good article on it.

You could attach different weapons to your character by selecting a specific vertex to be the attachment point, then use the position of that vertex as the transform for the weapon. Each frame, just look up the position of the vertex, and create your model-space matrix for the weapon from that. This way, if that vertex moves during the animation, the weapon will move, too.

Share this post


Link to post
Share on other sites
Okay.
After som thinking, I've decided to try to storing the animation a littlebit different that what I've got.

I'll make 1 D3DXPMESH for each object in my model(whit each own vertexbuffer and Indexbuffer), and then each object alså will contain 1 transform matrix for each frame. And this will be a transformmatrix witch is mutiplyed whit the parents matrix before it is stored, so that calcluation don't needs to be done runtime.
Then at least the vertexdata will be stored only once.

But... there is one problem whit this. I can't get the transformationmatrixes exportet/or imported right.

3dsMax is using a 4x3 transformation matrix. while direct X is using 4x4 matrixes. Maybe that could be a problem ?

What doees the 4'rth row in DirectX contain that the 3dsMAx dont contain, and how do i convert this?

EDIT :
Ahhh, 30 minuttes after posting this I finally got it to wark after spending 6 days on working on it. :)

[Edited by - Teleruin on December 16, 2004 11:21:00 AM]

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