Sign in to follow this  

COLLADA & DirectX (C++)

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

I've heard about the great features of COLLADA, however, I read that it not easy to work with COLLADA in DirectX. Is there some (free) API to load and use COLLADA files with DirectX (not Managed o XNA) in VS 2005?

Share this post


Link to post
Share on other sites
collada is just an xml, so it's difficult as read an xml.
I'm using collada in my framework (DirectX10 for .Net), and I've spend a pair of day to load data from it (using C++.Net is more easy, I understand).
Anyway, the logic behind the Collada file is quite easy, I didn't had any problem to load static mesh with generics semantic (the good thing of collada is that is extremely flexible and the free exporter for max permit to create all the information that I need like multiple texture format, tangent and binormal).

I've seen also animation (but I'll implement it in future) and it seems easy.

You just need an xml parser for C++ and see a couple of file (also the documentation is very good), then create empty mesh and load all data in it.


Share this post


Link to post
Share on other sites
Quote:
Original post by robydx
collada is just an xml, so it's difficult as read an xml.
I'm using collada in my framework (DirectX10 for .Net), and I've spend a pair of day to load data from it (using C++.Net is more easy, I understand).
Anyway, the logic behind the Collada file is quite easy, I didn't had any problem to load static mesh with generics semantic (the good thing of collada is that is extremely flexible and the free exporter for max permit to create all the information that I need like multiple texture format, tangent and binormal).

I've seen also animation (but I'll implement it in future) and it seems easy.

You just need an xml parser for C++ and see a couple of file (also the documentation is very good), then create empty mesh and load all data in it.


Well, you don't have to write the parser on your own, there already is an implementation for that for download. Gooogle more, or see the wiki. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by papitorico
Is there some (free) API to load and use COLLADA files with DirectX (not Managed o XNA) in VS 2005?


A quick search will give you a lot of answer for that question and most will be pointing to two libraries :

-COLLADA DOM: a library made at first by SONY (the collada.org website is still hosted by them) and now it seems to have been moved into Khronos hands

-FCollada: a library made by a company called Feeling Software.

After some hours trying to understand the COLLADA DOM. I've started working with my own implementation for COLLADA. I quickly dropped that project when I came across FCollada and started implementing my importer with that one. After about 8-12 hours of work I had time to study/learn the library and make a simple geometry importer for my engine and I took my time to make sure I was doing the right thing.

With the FCollada library I only had to load the polygons and get the vertices associated with it (along with other properties)... you also get access to the COLLADA's scene graph (for reading and writing).

I'm sure though that the COLLADA DOM is not that bad... probably my understanding of COLLADA is better and I'd be able to use it almost right away. In fact I think that their mostly equal except that FCollada seems to support multiple versions of the format which the DOM library doesn't seem to support.

My suggestion would be to look at both those libraries and also the forums on the COLLADA or Feeling Software website. There are also some projects like Benjamin, Nitschke's website. There are some XNA and DirectX projects with source in COLLADA.org forums... and it is basically the same thing except you'll probably need to rewrite it in C++ (since you asked for non-managed/XNA API).

I'd like to add one thing though... a mistake that a lot of people does is to use the format directly in the engine... COLLADA is made as an exchange format between applications and is not meant for real time applications.

JFF

Share this post


Link to post
Share on other sites
How about shaders, any diffference usins HLSL shader with COLADA?

One more thing, if COLLADA is an exchange format, that means, for example, that I can load an .X model and then import all animations and assets separately, and then use them having no problems. Am I right?

Thnx a lot for your answers!!

Share this post


Link to post
Share on other sites
Collada is just an exchange format, you can use for a software rendering engine, for directX7,8,9,10 with and without shader, fx, hlsl.
The best thing of collada is that it has a flexible format so I can create every type of data that I need.
I think that is not difficult to work with collada, I didn't had any diffucult in loading it.
I write my parser from the ground.
Just load the semantics to create vertex structure, load the series of float array (it separates data for each component) and pass them to the mesh locking it.


Share this post


Link to post
Share on other sites

This topic is 3873 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this