I'm looking for a way to export 3D graphics objects to the Collada (.dae) format. I need an automated way, i.e. using Blender to manually convert from another format is not a good solution.

I'm sure all of the following is not possible at the same time, but ideally:

  • Aspect ratio (BoxRatios) should be preserved

  • Colours should be preserved (if possible)

  • Visible bounding box should be preserved (if possible)

  • Initial view point should be preserved when opening the file in a viewer (if possible)

  • Supporting Polygon and Cuboid is sufficient.

Information that would help me implement this myself:

  • Which formats that Mathematica supports can theoretically handle most of the requirements above? Out of these, which one does Mathematica have the best support for?

  • Are there command line programs or other Mathematica-controllable tools that can convert a Mathematica-exportable format to Collada?


4 Answers 4


Here is a way of getting Mathematica’s 3D graphics into COLLADA format — e.g. for importing into iBooks Author on OS X — whilst preserving colour information. Unfortunately, this involves a manual intermediate step using Blender, but it is the only way that I have found that automatically preserves colour.

The trick is to use the fact that Blender can import/export both COLLADA and PLY formats whilst preserving colour in both cases. After some experimentation, it seems that these are the only 2 formats for which Blender preserves colour.

So the chain of processing is:

  1. Mathematica exports PLY
  2. Blender imports PLY
  3. Blender exports COLLADA

Here is a demonstration of a typical use of this workflow in OS X, which starts with a 3D graphic in Mathematica, and finishes with the 3D graphic in an iBooks Author 3D widget.

Generate a 3D graphic in Mathematica.

g = ExampleData[{"Geometry3D", "SpaceShuttle"}]

enter image description here

Add some random colouring to the graphic.

g2 = g /. 
  GraphicsComplex[pts_, data_, opts___] :> 
    GraphicsComplex[pts, data, opts, 
      VertexColors -> Hue /@ RandomReal[{0, 1}, Length[pts]]]

enter image description here

Export the coloured graphic to PLY format.

Export["test.ply", g2]

Import the PLY graphic into Blender, where it can be viewed colourfully (in “Vertex Paint” mode, for instance), and changes to position, scaling, lighting (etc) can be made.

Export the graphic to COLLADA format from Blender.

Import (drag-and-drop) the COLLADA graphic into an iBooks Author 3D widget, then preview the iBook to interact with the 3D graphic.

enter image description here

I had to scale the 3D graphic in Blender — this could have been done in Mathematica — so that the final result is as shown.


I've used Assimp for this, though I have never managed to preserve box ratios, the bounding box, or the view point.

Export["g.lwo", %]
Run["assimp.exe export g.lwo out.dae"]

enter image description here

For OS X, pre-compiled Assimp binaries are available in MacPorts.

  • $\begingroup$ Do you recommend 3DS as the intermediary format or you're also not sure which one is best? $\endgroup$
    – Szabolcs
    Jun 24, 2014 at 18:15
  • $\begingroup$ Yeah, I am unsure -- I just use 3DS out of habit because it has always met my needs. But the library supports quite a few formats. $\endgroup$
    – mfvonh
    Jun 24, 2014 at 18:19
  • $\begingroup$ This was very promising, but unfortunately both assimp 3.0 (MacPorts) and assimp 3.1.1 (compiled it) produces broken DAE files. Neither Blender, nor OS X Preview can read them. I tried a complex object as well as a simple Graphcis3D[{Cylinder[]}]. $\endgroup$
    – Szabolcs
    Jun 24, 2014 at 18:34
  • 1
    $\begingroup$ @Szabolcs Try .lwo, I was able to get that to open in Blender. Seems like 3DS is specifically not advisable because it's resulting in unescaped XML like this: <visual_scene id="<3DSDummyRoot>" name="<3DSDummyRoot>">. It seems to lose color info; it may be worth playing with the available formats. $\endgroup$
    – mfvonh
    Jun 24, 2014 at 18:51
  • $\begingroup$ Alternatively you could pass it back through Mathematica and try to clean up the XML lol $\endgroup$
    – mfvonh
    Jun 24, 2014 at 18:54

Mathematica 10.4 now supports Collada both as an import and export format:

  • $\begingroup$ Any idea when 10.4 will be released/what the other improvements are in it? $\endgroup$ Mar 2, 2016 at 0:18
  • $\begingroup$ @OleksandrR. I was able to upgrade my Home Edition license to 10.4 a moment ago through the "upgrade to the latest version" link in WRI site. It costs money, though... $\endgroup$
    – kirma
    Mar 2, 2016 at 15:12
  • $\begingroup$ @OleksandrR. Take a look at the chatroom. That's all I know. $\endgroup$
    – Szabolcs
    Mar 2, 2016 at 16:08

I have successfully exported many 3D Mathematica objects in the .stl format (used for 3D printing). I use Cheetah3D on the Mac (now $69) to work with the object, add axes or colors, then export as a .dae for use in Collada environments like iBooks Author. Maybe Google Sketchup would also work; it has Collada as a native format but not sure what it imports. Hope this helps!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.