PDA

View Full Version : Character animation: B3D loader in Pascal?



Ingemar
14-09-2012, 09:24 AM
I am working on improving my student laboration on skinning, and looking for a good file format and loader for that. Although we can't use FPC in the lab (usual combination of political reasons and ignorance) an FPC loader would be great.

Or are there other formats that would help for doing character animation?

Ingemar
21-09-2012, 07:37 AM
Nobody doing character animation?

Ñuño Martínez
21-09-2012, 10:29 AM
I've seen some projects that used 3D animations here. For example, the Mundo 3D MMORPG (http://www.pascalgamedevelopment.com/showthread.php?4190-Project-Mundo-3D-MMORPG) project. May be you can start there.

phibermon
21-09-2012, 04:51 PM
I've written an extensive model and skinning library with plug-ins for various well used static and animated formats as well as two custom model formats, one for importing from blender (along with an export plug-in for blender) and one binary format that is used for deployment (all models converted to this).

I'm not releasing the engine for a while but I'd be perfectly happy to talk designs, one thing that I can say with confidence is that it's always best to write your own format (so an export plug-in for your favorite 3D app) rather than try to use a pre-existing one.

ID softwares .md5 format and valves .smd format are obviously well structured for their use in a game engine but there may be licence issues using these formats for any commercial use. If this is not an issue for you then these formats are well supported with many tools available and are really easy to implement in code, providing you've got a good grasp of matrix math and an understanding of bone structure etc

if you do go down the custom format route and you want to use HLSL/GLSL then I reccomend storing quaternions and relative bone offsets rather than matrices (or calculating these from matrices and rest skeleton) as you transfer half the amount of data to graphics memory (the performance of native gpu matrix operations vs glsl/hlsl coded quaternion operations I'm not so sure on but it's ignore-quick regardless). It's also a good stepping stone for implementing dual-quaternions which produce superior mesh deformation, especially when bones rotate ('twist') around their own axis.

I personally use dual quaternion skinning for these reasons on the GPU and only calculate matrices on the CPU when I have a need to go in and out of bone space (eg attaching things to bones like particle systems, bullet spawning etc)

As far as animation key frames are concerned there's lots of options for lerping keyframes. Basic linear interpolation is easy and cheap but looks worse the lower the source frame rate. Some form of curve interpolation, splines etc is best (so the keyframe positions etc govern the curve control points).