Collada file loading?

Started by
20 comments, last by Mr Smith 14 years, 7 months ago
Hi everyone, We are busy with programming a graphics engine in OpenGL, but we face a little problem (rather a big one, if you aks me). We want to load Collada files in our engine. We have been looking for a way to do that, but until now we've only found FCollada and Collada DOM. But both libraries don't have much documentation. Could someone provide us with an in depth tutorial or example how to use one of these libraries? Thanks in advance. Mr Smith. [Edited by - Mr Smith on August 14, 2009 2:04:06 PM]
Advertisement
What I did was I wrote a program in C# using the .Net XML classes to pull all the data I needed out of the collada file and write it out to my own text based format that my c++ program could easily parse. It may not help you any but I thought I'd share.

[Edited by - santonel on August 15, 2009 12:29:52 AM]
I've had the same problem for something like a year now. Eventually I just abandoned collada. NeHe's got a good Milkshape3d loader, and you can derive a class for any other model type you'd need from the one it provides. MS3D is not a bad format anyway, so you may not need more than it provides. It'll take some specification studying to expand the one NeHe has, but at least you'll be making progress and not searching endlessly like I had to do for quite some time.
Look at the specification. The Collada DOM has a 1-1 correspondence with the spec and that is how I implemented my loader. Download the example collada files from here and try to first load the vertices, then the faces,material etc. It is true that Collada hasn't got much documentation online.
Also there is ASSIMP(though I haven't used it).

Hope this helps.
I've used Assimp, and I can tell that in the recent versions it loads most Collada files correctly. I'm also the maintainer of the Assimp Collada loader, so if you have files that fail the import or look weird when coming out of the loader, please send them to me. Preferrably small ones which clearly reproduce the issue :) Contact details are given at the page.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
I don't know any good tutorials, but I'll share my own COLLADA loading code from my game engine. It converts .dae to my custom model format.
http://users.utu.fi/tmwire/aether3d/files/convert_dae.cpp
http://users.utu.fi/tmwire/aether3d/files/common.h
My iOS 3D action/hacking game: http://itunes.apple....73873?ls=1&mt=8
Blog
Thank you for all the replies.

@EngineCoder Thank you for the source code of your loader. I'm a beginner with file loading.
Is it possible that your loader doesn't handle animations?

@Schrompf I also thought of Assimp, but as I told you before I'm only a beginner. I've not found
a way to use Assimp in my engine.

I would like to make a loader that loads geometry, materials, animations and lights

Thanks for your help already.

Mr. Smith
Check out Assimp, put the directory in the same directory as your VisualStudio solution, load the solution, click "Add -> add existing project" in the context menu of your solution, choose the correct visual studio project, compile. you're done. Now you only need to include the assimp headers relative to your own headers and link against it.

[edit] Just to be more specific: this is one of the methods to integrate a third-party library into your projects. This is not specific to Assimp. Sooner or later you have to learn how to use third-party libs. But until then you can also try to write your own loader or adapt an existing one. It's just... according to my experiences, the Collada format specification is a bitch to load, full of over-engineered needless complexity. That's why you rarely find an implementation which is able to load most files and provides all the features a game needs. The Assimp loader is one of those, albeit not perfect. It supports scene graphs, instancing, meshes, skinning and bones, animations, materials, textures, lights, cameras. That's why I recommend it, even if the process of integrating and using a third-party library seems to be complicated when you're doing it the first time.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
Quote:Original post by Mr Smith
Is it possible that your loader doesn't handle animations?


It doesn't handle animations yet, only geometry.
My iOS 3D action/hacking game: http://itunes.apple....73873?ls=1&mt=8
Blog
Sorry for the late reply, but I was on vacation.

@Schrompf I think I will use Assimp for my file loading.
Can you give me a tutorial how to load a file (Collada)?

[Edited by - Mr Smith on August 19, 2009 7:46:54 AM]

This topic is closed to new replies.

Advertisement