Archived

This topic is now archived and is closed to further replies.

Model animation

This topic is 5752 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m beginning research to make a 3D game, starting in part by spending much time looking over model formats and loading routines. Skeletal animation or something looks the most powerful, but by the explanations I''ve seen it looks all complex. I was wondering whether skeletal would be best, or if it would be fine just to have a model for each movement position, ala an animated sprite or a md2 file? And if I do an md2 file type of animation, should I be using md2 files? Or is it fine to use whatever file format is easiest for me to load and manage, saving a model file for each frame of animation? Or would that be horribly less space / processor effecient? Essentially, I''m just asking for opinions on the easiest way to load and animate a model while still being reasonably effecient.

Share this post


Link to post
Share on other sites
linear interpolation..

the results are very smooth, but the memory requirements are large..

check out the dolphin example in the dxsdk, there is a vertex blend example using linear interpolation. hardware blending or vertex shading really makes the interpolation fast at the cost of a memory. but its nothing a modern system cant handle.




{ Stating the obvious never helped any situation !! }

Share this post


Link to post
Share on other sites
No wait. Linear interpolation (bones, skinning, etc) has small memory requirement. Only one model is in memory. MD2 files, like Quake style, have big memory requirements because so many models are loaded up (one for each frame). LI just has more CPU intensity, which can be taken care of by a good graphics card that supports hardware vertex shading.

Share this post


Link to post
Share on other sites
While MD2 may require more models, LI requires more transformations. To my (uneducated and fuzzy) mind, the LI technique will also require a fair chunk of memory, but slightly less than MD2-style.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions | Internet Acronyms ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites


Tualin: wrong.

Linear interpolation is the process of producing intermediate frames from a series of connected key frames. Key frames are the same model snapshotted (is that a word?) over time. Memory requirements are dependent on the model size and number of key frames.

Quake (1, 2 and 3) models use linear interpolation with key frames.

Email me for some MD2/MD3 code.

eb.

[edited by - eagleboy on April 18, 2002 3:31:20 AM]

Share this post


Link to post
Share on other sites
eagleboy: I am not familiar with tweening, but linear interpolation seems awfully like mapping a spline from some points and then using some matrices to transform the object, this operation would be covered by the CPU, but memory requirements are minimal (store a some matrices and a spline). (Thats what the tweening sample looks like anyway.)

Speaking of memory and CPU, IK/FK is definitely more expensive to use than keyframing, although it''s cool because it''s often less work for the artists and provides a plethora of opportunities for other stuff. Oh and did I say with IK its so much easier you can probably script movements?

-------
"Programming is like sex make one mistake, and you have to support it forever."
Homepage: www.ussshrike.com/pcwebvia/

Share this post


Link to post
Share on other sites
Ok, maybe I have my vocabulary mixed up.

Take the SkinnedMesh example. It has one
mesh loaded in memory, and then a bunch of data structures
holding transformation data (very small in memory). With
it a model position can be interpolated based on time.
While this is a skinned model, based on the bones concept,
would ''linear interpolation'' be the wrong word for this method
of animation? If so, what is the correct term, just ''skinning''?

With only one copy of the model in memory, I would consider this a very small memory footprint compared to MD2 format. Even then, you can add more keyframes with a fraction of what it would take for the MD2 format, plus being time based, it can look more pleasing.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
So md2 is easier on the processor but (potentially somewhat slightly) harder on the memory? And looks worse? I imagine it must look okay, because Quake2 used it and that''s a pretty high profile tech-demo sort of game.
I''m pretty sure that, from all the tutorials I''ve seen on Q2 models, that it doesn''t have any linear interpolation in it, but rather a set of "frame" models which can be flipped through to create animation ... much like one would animate a 2D sprite. The common format I''ve seen is to have a render function kinda like this, "Render(int frame)", which doesn''t allow any interpolation, so far as I know.
Perhaps the Q2 engine did interpolation, but people don''t note it in the tutorial because the format doesn''t store interpolation data? I''m not sure how it would interpolate w/out storing interpolation data, though ... so I think it''s probably just that Q2 didn''t have any interpolation in it.

It seems that the reasons for doing an md2 model are for simplicity and to support low end systems.

What kind of system is the lower-end of fast enough to do a SkinnedMesh type deal? If I want a game to run on a low-end PC, maybe 200 to 300 mhz minimum, should I avoid this method?
And are there any good sample code / tutorials for this stuff on the net?

And I''d love to see some .md2 code, eagleboy! Expect to see an email from me shortly =) ... the great tutorial on gamedev gives code that doesn''t appear to be effecient (I don''t think it compiles it''s vertices?), and has a code sample that doesn''t compile (We both use VC++, we both use dx8 ... why wouldn''t it compile?) and is furthermore written in GERMAN. Which is something of a problem.

Thanks, I appreciate the help!

Share this post


Link to post
Share on other sites
Above is me. Sorry ... my connection was all screwy and I did not mean to do that multi-post thing ... sorry sorry sorry

[edited by - Zaphos on April 18, 2002 8:45:05 AM]

Share this post


Link to post
Share on other sites
I made another post today entitled something like "SDK Skinned mesh example outlined". I went through the important functions and tried to explain what is going on. Sooo many people have asked about a detailed outline of that sample, so I gave a shot at it.

In it you will see it only loads the mesh one time. Animation keys are kept in seperate data structure instances. Over half the code is for loading, so in all it is really easy to implement, especially since there is so many DX functions available. The code seems big because it covered 4 different rendering types, including vertex shaders, which I concentrated on.

One reason a bone model is important is because it saves time. For example, if your main character wanted to be able to combine many different animations at one time. I believe starting in Quake 2, they split the model into two different ones, but this is not enough. You would generally need animations for the head(talking), arms(shooting, signals) and legs(running/walking/standing) to be different. If you are going to split up an MD2 file format that much, you might as well start using a bone oriented model because that is what it is becomming.

At this point you need to ask what you need out of your animations. I think MD2 format gets the speed, but with today''s video cards, and hardare vertex shaders, doing all the lerping in boned animations are just as fast as framed animation. This is a good time to dig into shaders because it looks like they are here to stay. If you are going to develop for a system like the XBox, you have to use them. With them, you can outperform other systems, without, it is only a Pentium 3.

Please understand, I am not some shader elitist, it is just what I started researching lately, so I love to hear about their pros and cons.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Zaphos, it''ll depend greatly on your requirements for the game. If your characters are going to wear ''soft'' clothing (to very loosely borrow the technical term) such as cloth or bare skin, then skeletal with vertex blending is the way to go. However, if your characters are all wearing rigid full-plate armor, you can easily get by with a more traditional hierarchical animation (somewhere between skeletal and full-model frames).

It''ll also depend on the distance the camera is to your character. For the game I''m working on, I''ve got little tiny people wearing armor so I''ve gone the later route to save some time. Both in terms of not having to implement the skeletal system, but also in terms of asset design/development. Remember that if you go the skeletal route, you''ll have to bone and skin your models. Skinning (correctly) is a pain and personally, I''d rather not have to do it if it isn''t even that visible in the end product.

As for file format, I suggest you take a look at the SkinMesh demo that comes with the DirectX8 SDK. It uses the X file format which is a relative time-saver since it supports both text and binary modes without any additional code. Text mode comes in handy when you have to debug your animation system, while binary is obviously faster on loading.

The SkinMesh demo uses blended vertices and bones but you can still use it to derive a hierarchical animation system.


TLC

Share this post


Link to post
Share on other sites
That link is ...

http://www.gamedev.net/community/forums/topic.asp?topic_id=90762

Share this post


Link to post
Share on other sites
Hmm ... thank you kindly! Yeah, the skinned mesh example, if I can understand it properly, looks like it will help me much. I''m planning on doing a 3rd person game (ala Tomb Raider, Mario 64, etc) with a camera that spends it''s time close enough to the models that looking "pretty" will be important. So now I guess I''m doing skinning ... argh ... I''m changing my mind so frequently ...
But yeah, I can see skinning as being the best thing to learn, because the .md2 format, while being simple, is rather non-functional (comparatively), and as power increases and libraries/code-examples spread, skinning will be the method to use.

Thanks for the article thingy, Taulin, I need to look at it yet, but I was really wanting some sort of guide to the skinned mesh stuff ... MS sample code is so bloated with features that it gets pretty difficult to read. It looks, just by glancing at it, that the forum code brackets messed up your text slightly, though ...note the "¢ىCreate a new Sframe- tempFrame ¢ډSet tempFrame¡¯s name from the data" ... unless you were intending to write that ...

Share this post


Link to post
Share on other sites
Hello. I just thought I''d help out here.

Skeletal / Bones animation - A bone / skeletal system is usually less memory intensive than keying all your models'' animations. For keyed animation to look good, most animation systems interpolate the keys - this does NOT require extra information from the model file. You simply take the two keys and apply an interpolation algorithm to get an inbetween animation state. With a bone system you can use the same bone animation for different models, and thus reducing your animation memory usage. You can have segemented or skinned bones. Segmented looks fine until you get close. For example on PC, Quake 2 & 3 uses segmented bone animation. Skinned bones are usually for close cut-scene-in-engine-shots. And skinned bones come in various forms, depending on how you handle the vertex information around the bones. Most skinned models use vertex-weighting to ensure correct looking vertices when bones are moved.

Heres a few handy links to some character animation information.

http://miralabwww.unige.ch/
http://ligwww.epfl.ch/
http://research.microsoft.com/graphics/hfap/
http://www.h-anim.org/
http://www.discreet.com/products/cs/

Hope this all helps.

Share this post


Link to post
Share on other sites
quote:
Original post by Taulin
No wait. Linear interpolation (bones, skinning, etc) has small memory requirement.


Depends on the type of linear interpolation. Keyframe interpolation (which is what was being discussed in the post you were replying to) is VERY memory intensive.

I would advise strongly against going that route if you're models are going to be complex. Its easy to implement, but very limiting in the long run (in my opinion).

(edit)
Let me clarify a bit more, doing Keyfrom interpolation between models is expensive. In this method, you load the vertex data for all the frames into memory, then interpolate between the frames (based on time) to get smooth animation. As I said, this method can be very memory intensive because, for an animation with 5 frames, you are loading 5 copies of the model.


[edited by - DanMan on April 18, 2002 2:19:02 PM]

Share this post


Link to post
Share on other sites