This project has moved and is read-only. For the latest updates, please go here.

CMO vs XNB vs FBX File Sizes

Jan 4, 2014 at 7:19 PM
I am an indie developer building a game that leverages the DirectX Tool Kit. I am grateful for this API and it is incredibly valuable in the absence of XNA. This forum post is about the CMO format used in the Visual Studio pipeline. I definitely understand that I have the ability to write my own format -- and as an indie developer you can probably understand why I am reticent to do so. I am hoping to understand the value the CMO format provides over XNB or .X.

One thing I noticed is that thereis a significant difference in output file size between XNA XNB files and VS Pipeline CMO files. Here is a sample comparison:

FBX 92 Kb
XNB 517 Kb
CMO 1133 Kb!

So the CMO file is ten times larger than a FBX file, and interestingly, twice as big as an XNB file. Since shaders are compiled out into separate files, I am wondering why there is such a dramatic difference in file size. Is it that XNB files are compressed and CMO files are not?

The .X file format did a great job of storing minimal formatting -- it was largely raw vertices, indices, and texturing coordinates -- I wonder how things have progressed with the CMO format.

I think this question dovetails into an earlier post I made (https://directxtk.codeplex.com/discussions/479123) about the desire for some developers (at least myself) to understand the trade-offs between what existed in XNA and what is being offered through the DirectX Tool Kit today. Clearly, the DirectX Tool Kit is an independent offering developers who are passionate, and so I am grateful for the API. In terms of building the best solution available, I feel I have a lot to learn to better understand the post-XNA landscape for indie developers.

Thanks,
Shaun
Jan 5, 2014 at 8:19 AM
Edited Jan 5, 2014 at 8:24 AM
In most cases, 'real-world' .FBX files are rather larger than 92 Kb, so this is probably not an entirely fair comparison case to be judging runtime formats.

That said, .CMO is designed to be simple... not to be particularly compact. Vertex data is written as a fixed 52-bytes per vertex plus an optional 32-bytes per vertex if skinning. Most other runtime formats use a variable vertex declaration which can be more compact if you are not making use of the all the data. The .CMO animation data is also written as full 4x4 matrices which is not as compact as say a multi-track system of independent translations, rotation quaternions, and scales. In any case, this is probably feedback that should be directed to Visual Studio if you feel that .CMO files are too bloated. I would note that they compress with dictionary compression very well, so the overall size of .AppX packages won't be particularly larger using .CMO over some other format--in other words, they may take up more space once installed but download size isn't really going to be a major problem using .CMO.

PS: Perhaps you can try the same .FBX with the Sample Content Exporter and see how large it ends up as an .SDKMESH?

Unless your game is particularly animation or geometry heavy, the size of the .CMO is unlikely to contribute significantly to your final game size. Textures and audio tend to dominate over geometry data.
Marked as answer by walbourn on 1/5/2014 at 12:20 AM
Jan 5, 2014 at 6:04 PM
Hi Chuck. Thank you again for the detailed reply. I went back and took a look at my source FBX files and sampled different sizes, including source FBX files that are 2MB in size. My FBX source meshes are not animated. What I observe is the following ratio of file size: FBX is N. XNB is N * 5. CMO is N * 10. Compression changes the ratio as follows (FBX remains uncompressed): FBX is N, XNB Compressed is 0.5N, and CMO Compressed is 5N. I'll definitely try out SDKMesh and compare it to CMO.

I read through the XNB file spec today and I see what you mean by variable declarations. There are leading bits to signify the width of the data (i.e. vector2, vector3, etc). Both CMO and XNB formats are uncompressed binary, and so your explanation makes sense. I'll submit a ticket to Visual Studio Connect -- I think this size difference can be meaningful for projects with large numbers of models.
Nov 5, 2015 at 5:44 AM
Edited Nov 5, 2015 at 5:45 AM
Hi Chuck. Thank you again for the detailed reply. I went back and took a look at my source FBX files and sampled different sizes, including source FBX files that are 2MB in size. My FBX source meshes are not animated. What I observe is the following ratio of file size: FBX is N. XNB is N * 5. CMO is N * 10. Compression changes the ratio as follows (FBX remains uncompressed): FBX is N, XNB Compressed is 0.5N, and CMO Compressed is 5N. I'll definitely try out SDKMesh and compare it to CMO.
Hi Chuck! I hope you are doing well. I thought I would reach out and reiterate how subpar the CMO format is compared to XNB. One could argue that the value of DirectXTK is only as good as the data formats it supports. I appreciate DirectXTK immensely -- I hope someday support for a more compact file format is achieved.

Thanks,
Shaun
Nov 6, 2015 at 2:30 AM
Have you taken a look at SDKMESH?