Jump to content
  • Advertisement
Sign in to follow this  
Mr Smith

OpenGL Collada file loading?

This topic is 3249 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

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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mr Smith
Is it possible that your loader doesn't handle animations?


It doesn't handle animations yet, only geometry.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!