Collada 3D File Loader Class?

I just started working on an OpenGL Project but I need some help to finish it.

I’m looking for a class that will load in a Collada 3D file for a game I’m doing. I need to learn how to load in the vertices, textures, and animations that the file will have, does anyone know if one exists? Even if there is a paid one?

You may have to do the parsing yourself.

Spec

Parsing Collada is a massive undertaking .

I’m busy finalizing the next tutorial on Xojo3D.com that is all about File IO. As part of this tutorial I’m releasing the first version of the open X3 Data Format specification.

X3DF does not have the amount of features that Collada provides, but it does have support for all the basics including textures and is super easy to use. In the tutorial you get the free X3IO module with which you can load and save 3D assets.

Instead of using XML the specification uses JSON for two reasons…

  1. JSON uses less space than XML.
  2. To make it easy to transport 3D assets across a network (ie. web applications).

I plan to expand this specification in the future to include more advanced features.

This tutorial is still in alpha and needs to be tested on OS X and Linux, but here is a link to it if you want to get a sneak preview…

Xojo3D.com Tutorial 14

And the Xojo project file…

Tutorial 14 Project ZIP

The Xojo3D.com roadmap includes a 3D asset modeler, named X3 VectorJam, that is written 100% in pure Xojo without using any external libraries (mostly same code as that used in Xojo3D.com tutorials) and fully supports the X3DF format (it uses the exact same X3IO module to load and save X3 assets.

X3 VectorJam is in alpha (alpha version 4 already)… here is a screenshot of X3 Vectorjam (still need to add toolbar icons).

This 3D asset consists of 98237 vertices and 169735 polygons.

The X3 Data Format is not as feature rich as the Collade implementation, but could get you started with loading and saving models.

I’ve been going through all your tutorials. They are the best I’ve ever seen written, not just in OpenGL … but period. That said, I went over your next tutorial and realized that the format you are working on currently won’t work for what I had in mind. I need the ability to have animations stored in the files, that way when I design and model them, I can see how they look, and we can put them into the game as simply as possible.

My understanding currently of how animation will work:

  • Lets say we have a 1 second animation, we will make ‘30’ frames for it.
  • This means, 30 different X3Models that represent the animation.

So I’m thinking of making an X3Animation Class which will hold an array of models from which I can cycle between the models to create the animation effect during the render phase. Is this a good approach? Is this efficient?

Another avenue on a Mac is to use Apple’s SceneKit Framework. It does most of the heavy lifting for you including parsing Collada models and the setting up of OpenGL. I have a proof App done in Xojo here.
http://bigdaddysurf.com/blog/?p=609

I see you use SketchUp Thomas… it’s a great tool for modeling.

Thank you for the kind words.

This is absolutely next on the todo list for the X3 Data Format specification… support for animation. Already logged as a ticket in my tracking system. Unfortunately no ETA on this.

[quote=31041:@Joe Astrahan] Lets say we have a 1 second animation, we will make ‘30’ frames for it.
This means, 30 different X3Models that represent the animation.

So I’m thinking of making an X3Animation Class which will hold an array of models from which I can cycle between the models to create the animation effect during the render phase. Is this a good approach? Is this efficient?[/quote]

I would highly recommend that you look into interpolation and skeletal animation. With interpolation you only have to store the model once, and then some data about the position and rotation of the model at certain points in time. Much more memory efficient.

Here are some tutorials from the old Real 3D Tutorials website. The projects should open and run with Xojo (you’ll find the download links at the bottom of each tutorial page).

Tutorial 13 - Skeletal animation
Tutorial 16 - The key in frames
Tutorial 17 - Keyframe interpolation

as well as a tutorial on Collada…

Tutorial 21 - COLLADA imports

The code in this tutorial is far from complete nor very optimized for speed, but should give you a starting point if you want to write your own COLLADA parser.

[quote=30922:@Alwyn Bester]I’m busy finalizing the next tutorial on Xojo3D.com that is all about File IO. As part of this tutorial I’m releasing the first version of the open X3 Data Format specification.

X3DF does not have the amount of features that Collada provides, but it does have support for all the basics including textures and is super easy to use. In the tutorial you get the free X3IO module with which you can load and save 3D assets.

IThe X3 Data Format is not as feature rich as the Collade implementation, but could get you started with loading and saving models.[/quote]
I am watching your work with great interest too Alwyn. My simple case at the moment is that I want to create or obtain some 3D objects and then be able to render them in controls on-screen and modify the lighting by code. I have one such object that I created in Blender and I can export it in the 8 formats that Blender supports. Are you likely to have a function to fully import from one or more of these? I did experiment with parsing Wavefront files but it was taking me a long time to get even a poor result and so a solution from yourself with far more knowledge than mine would be great.

Absolutely. A tool is already in development, X3 FileAssist, and the first release will support importing and exporting the following formats:

*.x3m (X3 Data Format Models)
*.obj (Wavefront object files)

In fact, the Lamborghini Avent in the screenshot above was translated from an .obj to an .x3m file using X3 FileAssist, and was then loaded from the .x3m file into VectorJam.

X3 VectorJam will only support X3M (X3DF) files, but X3 FileAssist is a separate application with the dedicated purpose to translate between different file formats.

The reason why X3 FileAssist is a separate application, is so that 3D engineers can eventually automate their 3D production pipeline by translating between different file formats using the command line, and thereby possibly automate selected tasks in their pipeline.

My vision with the X3 ecosystem is that you can for example start modeling your models using X3 VectorJam, and then export the models to Wavefront .obj files (or other future supported formats), and continue work on these models using applications that might have features not yet available in X3 VectorJam… and then convert them back to x3m when you want to use the models in your own Xojo applications.

I’ve picked up from the Robotics conversation that there is also an interest in the .STL and .AMF 3D printing file formats. X3 FileAssist might include these formats eventually, but I first need to get other basics in place.

Obviously there is still loads of work the be done to get to a commercial level 3D production eco-system, but like they say… it is best to eat an elephant one bite at a time.

[quote=31142:@Alwyn Bester]Absolutely. A tool is already in development, X3 FileAssist, and the first release will support importing and exporting the following formats:

*.x3m (X3 Data Format Models)
*.obj (Wavefront object files)

[/quote]
Nice, when you are ready let me try to eat a small piece of elephant for you by trying to get my simple 3D objects imported as Wavefront files if it helps.

What OS do you use Carl, Windows, OS X or Linux?

Windows and OS X primarily but can do Linux too, I do test my application on Linux sometimes and would like it to work 100% when I have polished it Windows & OS X.

Great… will be in contact as soon as X3 FileAssist Alpha 1 is ready.

Please do :slight_smile:

Carl, if you are still interested in a piece of 3D elephant pie, I’ve sent you a private message.

Anyone else who might be interested in trying out alpha 3D tools, that is designed to be compatible with the free source libraries at Xojo3D.com, feel free to send me a private message for more information.

I’m very interested as well, right now I’m using obj (Wavefront object files), and for animation plan to have a folder with just a bunch of them (I found out I could make multi-exports with blender to wavefront file format). So this will appear to work and the format is really easy to understand to read. I am interested none the less in what you have.

I’ve sent you a PM with the details Joe.

Thanks I joined :).