COLLADA Exporter

44 posts in this topic

I've spent the last two or three days writing a COLLADA exporter for 2.10 and have got as far as exporting the geometry, normals and texcoords, and being able to import them into an application that supports COLLADA (For me this is the C4 Engine). I'm at the stage now of working on the materials and images that are exported and would like some help if anyone fancies offering it in the following areas:

UPDATE : The first release is available from here. Extract the ColladaPlugin.dll to the \Plugins\MeshCodecs folder of your 3DC installation.

Share this post

Link to post

Share on other sites

Hi Andrew, is there a way of referencing the Mesh data, i.e. Raw data and position data per individual object rather than for a whole scene ? COLLADA requires each geometry has its own vertices, normals and texcoords self contained and then referenced within the same geometry node as a polylist. I was thinking maybe of re-indexing the Raw data for each geometry, but this could be time consuming, and another way I suppose would be to include all of the scene vertex, texcoord and normal data for each geometry so at least the Raw data references would work, but the file size would be quite large and wasteful.

The only other way would maybe to include some extra data in the Mesh that is exported in the Encode function.

Have you any ideas ?

Share this post

Link to post

Share on other sites

Hi Andrew, is there a way of referencing the Mesh data, i.e. Raw data and position data per individual object rather than for a whole scene ? COLLADA requires each geometry has its own vertices, normals and texcoords self contained and then referenced within the same geometry node as a polylist. I was thinking maybe of re-indexing the Raw data for each geometry, but this could be time consuming, and another way I suppose would be to include all of the scene vertex, texcoord and normal data for each geometry so at least the Raw data references would work, but the file size would be quite large and wasteful.

The only other way would maybe to include some extra data in the Mesh that is exported in the Encode function.

Have you any ideas ?

Now every point has global position, no additional shift for every object. You can set offset (0,0,0) for the root of sub object of calculate center of sub object and subtract this value from positions. I thingk it is not very time consuming. Also one note about scale - usually all is measured in meters.

Share this post

Link to post

Share on other sites

Now every point has global position, no additional shift for every object. You can set offset (0,0,0) for the root of sub object of calculate center of sub object and subtract this value from positions. I thingk it is not very time consuming. Also one note about scale - usually all is measured in meters.

Sorry Andrew, ignore my ramblings, it's amazing what a night's sleep can do ! I'd forgotten to initialize a variable and it was giving unpredictable results.

Anyway, the geometry is being output correctly now and I'm just re-going through file with COLLADA refinery to make sure it adheres to the spec.

Share this post

Link to post

Share on other sites

I'm just finishing off understanding COLLADA texture file locations and UV scale, once that's done, I'll post a plug-in to try. There's still a lot of optimizing to do, but I'll get it working correctly first.

Anyway, here's the test model exported from 3DC and imported into a game engine.

I used TinyXML for the last Collada exporter I wrote as well, but I was thinking of moving onto the Collada DOM to support more advanced features, and to make it easier to write out conforming Collada files.

However, in the case of 3DC, it doesn't appear that it supports animation or hierarchical transforms, so TinyXML will probably do just fine for basic Collada files that are only handling static, multi-textured geometry.

Please let me know if I can help out with the implementation of writing out the texture file locations - it's a bit subtle how the cross references are supposed to work.