Projects

skelmod.

QFusion game mod adding support for skeletal player models using animation blending. Skelmod is not oficially finished, but it's working and pretty stable (no serious crashes found yet). It's not packed with any documentation, tho, so it's up to you to figure out by yourself by looking at the code and the examples provided.

The skeletal models used for animation blending are in SKM format. SKM is QFusion's native format (based on DarkPlace's DPMs), and they are converted from Half Life's SMDs using the SKModel. Animation's are defined by a animation config similar to Q3Arena's one, tag bones are also defined in the animations config. Examples of this config can be found in the sample player models I did (not really, they're converted) for my tests. The source files for these player models can also be downloaded here. The sources are in milkshape and SMD format. There is also available a SKMviewer tool.

And, finally, you can get a zipped version of skelmod right here or, if you prefer being sure you have the latest version of the code, you can surf skelmod's webCVS or perform a cvs checkout:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/splitmod login

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/splitmod co skelmod

 

How Skelmod works? (think Lego).
I don't really know how other skeletal animation blending codes work. I didn't do any research on it, so I don't know if this can be applied to most skeletal formats, or it's valid only for skm models (and dpm I assume). The way I did animation blending is as follows:

First, let's try to put in a few words how skm store the skeleton information. I use to think about them as Lego (the build game with colourfull pieces, yes) boxes. Imagine that each animation frame is a Lego box, containing the pieces you need to build your human figure in the pose (like: Box contains: 'Walking main frame 1"). This way, our model would contain a bunch of Lego boxes (frames) each one containing the pieces to build the figure for each frame (the bones). What the engine does is opening the Lego box for the frame it wants to draw, but, even when you have the pieces, the figure is not there, you have to build it. The same happens in the engine, you have to build your figure (I call this step 'transform the boneposes' in the code) putting each bone on top of it's parent (see the lego reference?). Once this figure building step is done, the skeleton is ready to be sent to the renderer, where the meshes will be tranformed by it and drawn (that's not our business, the engine will do it itself).

So, in short, the game code opens a frame 'lego box', builds the lego figure and sends it to the renderer. As simple as that. How's animation blending done then? Think Lego: Say you have two Lego boxes, one for frame 1 box: 'Man walking' and the second for frame 27 box: 'Man shooting', and you want to combine both lego figures, how would you? Picking the legs pieces from box 1 and the torso/arms from box 27 and mounting the figure with them. That's exactly what I do in the code. I just needed a way to know what pieces were from torso and what pieces were from legs. As the bones have names I just decided to begin with 'u' all bones names from upper and with 'b' all bones names belong to lower. In skelmod this is defined in the animation config, and it only requires that the bones names follow the same scheme as it's in the config. The code will then use that first character in the bone name to mount (transform) the bones.

I hope I got to make it understandable. It isn't that complex, just confusing.