Collada Exporter

Over the weekend I was able to get the Collada exporter to the same state that the old Maya exporter was in. It can export scenes and geometry for use in the engine.

Getting the Collada exporter up to spec took a little more work than the Maya exporter. With the Maya exporter I was able to do very high-level operations on geometry. For instance, I used the obj exporter to compute the world space transforms of a set meshes in one step. There is no such functionality in Collada, but it was simple enough to implement.


Efficient Geometries

While writing the Collada exporter I took the opportunity to modify the mesh architecture in the engine. Previously the exporter collapsed geometry by material. All meshes with the same material would be collapsed into one mesh object. Each mesh stored its own vertex data and index buffer. This is a straightforward approach but is a bit naive. It results in many small vertex buffers and a lot of vertex buffer switching.

An observation I made is that vertex data and material are not explicitly linked. In other words, there is no reason to split up the vertex data by material. On the other hand, the index buffer must be split up by material so that the renderer can stop and bind a new material before drawing the next set of polygons.

The modified architecture splits up vertex and index buffers into Models and Meshes. A Model contains all vertex data and a list of Meshes. A Mesh contains a material and index buffer to index it’s parent Model’s vertex data. Using this architecture all vertex data, regardless of material, is collapsed into one vertex buffer. This system prefers larger vertex buffers and requires much less vertex buffer switching.


Back to Collada
In the end, Collada exporting is much faster. The command line Maya exporter had to dynamicly link with Maya’s HUGE DLLs. This process caused the exporter to stall for 3-5 seconds at startup. This lag time quickly added up when exporting multiple scenes. With the Collada exporter the export is instantaneous.

Things I’m looking forward to:

Collada Refinery
There is a collection of utilities for “conditioning” the data in Collada files. Examples of conditioning include tri-stripping to increase rendering performance. These utilities are collected under the name Collada Refinery.

Collada Physics
Collada handles physics attributes and many collision volumes. Building a physics system into the engine that uses this data would be very interesting.

ColladaFX
Integrated shader parameters and shader code in the Collada files. ColladaMaya even supports rendering using these shaders in Maya views.

Leave a Reply