# 3D file formats
I'm going to be doing a lot with programatically manipulated models. Therefore there's a benefit to me in using a file format which is human-readable, and also easily parsed. Compactness is also a virtue, but it's a virtue I can achieve by compressing human readable files, I think.
Loading time is an issue, but I will be loading relatively few models and manipulating them in memory to produce large numbers of variants, rather than loading a new model for every asset I wish to place. So both from the point of view of total disk space and from the point of view of performance, I think that formats which are optimised more towards my needs as a developer than to raw performance or storage size are probably justified.
Obviously jMonkeyEngine's own `.j3o` format is something I can parse -- because I have the native jMonkeyEngine libraries to do it -- but it's not something I can inspect or hand edit, so I'm unwilling at this stage to use it. As I understand it, it's a file of serialised Java objects, which, if so, would make it relatively efficient to load.
## XML formats
XML formats are easy to parse; they're also reasonably easy to edit both as text files and as structured files. So my preference is to use them as a starting point for search. The obvious XML formats are
1. [3DXML](https://en.wikipedia.org/wiki/3DXML), a proprietary format owned by Dassault Systèmes;
2. [Collada](https://www.khronos.org/collada/), an open format apparently seen primarily as an unlossy interchange format between 3d applications;
3. [X3D](https://www.web3d.org/x3d/what-x3d/), an open format seen as the successor to (and much more prolix than) VRML;
4. Ogre 3D, a format designed for the [Ogre 3D game engine](https://www.ogre3d.org/) and now widely used in the jMonkeyEngine community, but for which I can find no user-oriented documentation.
## JSON-based formats
JSON is also easy to parse and to edit; the [glTF 2.0](https://www.khronos.org/gltf/) standard, in its JSON/ASCII representation, is such a format.
## Other text formats
[VRML](https://en.wikipedia.org/wiki/VRML) isn't either XML or JSON, but it looks reasonably easy to parse.
## Features
| Name | XML | JSON | Blender | MakeHuman | jME3 | Notes |
| -------------------------------------------- | ------- | ------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [3DXML](https://en.wikipedia.org/wiki/3DXML) | ✓ | | [Unsupported](https://blenderartists.org/t/3dxml-importer/469975/2) | No | No | Proprietary; apparently, engineering oriented |
| [Collada](https://www.khronos.org/collada/) | ✓ | | Built in importer/exporter | Exporter | [No](https://hub.jmonkeyengine.org/t/collada-io/46406) | Prolix, but sort-of interpretable and manageable. |
| [X3D](https://www.web3d.org/x3d/what-x3d/) | ✓ | | Built in importer/exporter | No | No | |
| [Ogre 3D](https://www.ogre3d.org/) | ✓ | | [Unsupported](https://github.com/OGRECave/blender2ogre) | Exporter | [built in importer](https://javadoc.jmonkeyengine.org/v3.6.1-stable/com/jme3/scene/plugins/ogre/package-summary.html) | |
| [glTF 2.0](https://www.khronos.org/gltf/) | | ✓ | Built in importer/exporter | No | [built in importer](https://javadoc.jmonkeyengine.org/v3.6.1-stable/com/jme3/scene/plugins/gltf/package-summary.html) | On inspection, the glTF 2.0 files generated by Blender are thoroughly inscrutable. Although they are technically text files, they're essentially very thin wrappers around ascii-coded binary blobs. This doesn't look usable to me. |
| [VRML](https://en.wikipedia.org/wiki/VRML) | | | Apparently accepted by the X3D importer; no exporter | No | No | I couldn't make import of a sample file into Blender work. The import completed with no errors, but no objects appeared in the scene. |
## Discussion
I did not investigate 3DXML, because I'm not going to sign up to even a free licence from an armaments company.
Of the rest: I'm pretty disappointed.
### glTF
**glTF** might as well be a binary format; it's unusable for my purposes.
### X3D
**X3D** export of the simple cube from Blender results in a file which is readable, but which does not have explicit vertices or edges. Instead it has an attribute whose value is a string representation of a sequence of 24 numbers:
```xml
4 0 0 2 0 1 0 0 2 2 1 3 7 1 4 3 1 5 6 2 6 5 2 7 7 2 8 1 3 9 7 3 10 5 3 11 0 4 12 3 4 13 1 4 14 4 5 15 1 5 16 5 5 17 4 0 18 6 0 19 2 0 20 2 1 21 6 1 22 7 1 23 6 2 24 4 2 25 5 2 26 1 3 27 3 3 28 7 3 29 0 4 30 2 4 31 3 4 32 4 5 33 0 5 34 1 5 35
` element, which is eighteen numbers per triangle; and since the highest number is 35, they're not indices into either the `Cube-mesh-vertices` (8) or the `Cube-mesh-normals` (6) arrays, so that implies they are indices into `Cube-mesh-map-0`, which *does* have 36 entries...
```xml