22
\$\begingroup\$

I'm currently writing a 3D game in C++ with OpenGL and I'm coming to the part where to load 3D models in. Therefore I'm looking for popular file formats and techniques to

  • display static meshs and
  • render animated meshs.

I've already found quite a large number of possible formats and techniques, like keyframe animations, skeletal animation, MD2 up to MD5, 3DS, X, Collada etc. pp.

For simplicity I'd like to use a format (and technique) that allows both, namely static and animated meshs. So my question is if one format is suitable for that task and which one you'd suggest. And to clarify a bit: I don't need super-smooth animations or brandnew features.

Sidenote: Because I'm a blender fan (but not an expert ;-)) it'd be helpful if it can be used with that -- but of course that shouldn't be the show stopper, here.

\$\endgroup\$
0

1 Answer 1

16
\$\begingroup\$

Let me propose you to use Collada.

It's widely supported by DCC tools and well standardized. It supports skeletal animations and .. well, it does almost everything, including shaders and physics - those won't be relevant for you.

Vertex-based animations such as in the MDL or MD2 formats are more or less a relict of the past. Today, most animations are skeletal animations (i.e. think if smoothly-rigged characters) and the content creation tools are optimized for them.

Blender has a working Collada exporter, but as always, exporting stuff from Blender can be annoying. You may need to try alternative exporters or file formats or hack the scripts manually should you experience problems.

To load Collada, use libraries such as FCollada or ColladaDOM (Don't try to parse it on your own, Collada is a really fat XML monster ...). There's also Open Asset Import Library, which loads ~25 file formats, including Collada (and all the other formats you mention). It would be an excellent choice since it aims especially towards game developers and provides its output in a format suitable for real-time rendering. But to be honest: I'm one of its co-authors, so I'm probably a bit biased.

Last but not least: The file format you use to import your assets should not define the abilities of your engine and the techniques it uses - it should rather be the other way round. Whether your animations are super-smooth is not a question of the import format, it's about which technique you use to animate meshes and how good they are modeled in the first place. The import format should just help you bring your data from Blender into your game.

\$\endgroup\$
5
  • \$\begingroup\$ Thank you very much for your detailed answer. I heard of Collada the first time today (recommended by a friend) and wasn't sure if it's really ready to be used in a production environment. I'll give it a shot now, thanks. :-) \$\endgroup\$ Commented Mar 30, 2011 at 12:08
  • 2
    \$\begingroup\$ Good advice, especially the reference to AssImp. I wouldn't suggested COLLADA, though, as nobody seems to consistently and correctly support all of it, and it is rather large for actual content purposes. I'd suggest using something like MD5, which gets you the skeleton and is pretty widely implemented correctly (I think). I'd also not dismiss quite so easily MD2; there are a lot of sample models out for it, and you can trivially animate it cheaply (though it is useless for ragdolls or what have you). \$\endgroup\$
    – ChrisE
    Commented Mar 30, 2011 at 17:32
  • \$\begingroup\$ I will just play around with different file formats. Thanks to AssImp, that'll be easy to do. MD2 was indeed my first idea, however it's quite expensive to create, I think, instead of just exporting the proper bones. Ragdolls are not needed in my case, I just need animated models, no physics involved. \$\endgroup\$ Commented Mar 30, 2011 at 20:15
  • \$\begingroup\$ There are indeed very bad Collada exporters out there, but at least is the format well-documented so you always know whom to blame :-). MD5 is a good candidate, too, but I don't know how good the Blender exporters are. MD2 has a very limited vertex representation and suffers from size and accuracy limit. I really wouldn't use it, there is no reason to do so. \$\endgroup\$ Commented Mar 30, 2011 at 20:28
  • \$\begingroup\$ wazim.com/Collada_Tutorial_1.htm is a pretty good in-depth tutorial for loading collada, but I'd still recommend using a library instead. \$\endgroup\$
    – Exilyth
    Commented Apr 29, 2012 at 17:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .