Converting MagicaVoxels Marching Cube for your game
This article is a guide to converting the MagicaVoxel .ply (marching cube) format into a usable, optimal FBX file that includes a texture instead of using vertex coloring.
As an example I’ll be using the below fist for the guide.
Starting from here You’ll want to go to the bottom right of MagicaVoxel and select Export>MC
Afterwards, you’ll be handed a handy-dandy [filename].mc file in Magicas Export folder
You’ll need to download a tool called Meshlab to convert the .mc file into a DAE file
(Meshlab download link: http://www.meshlab.net/#download)
By simply dragging the [filename].mc into meshlab, you’ll get the above result.
Now go to File> Export Mesh As…
And export the file as a DAE format (as to retain the vertex colors read in the model)
With your new [filename].DAE you can import this model into Maya or any other 3d modeling tool, so long as you can export as an FBX.
For the sake of my pipeline, I’ll be using Maya.
Drag in or import the DAE you’ve created and this should be the results you get:
To make sure the vertex colors are still there, Select your model, then go to Mesh Display > Toggle Display Colors Attribute. (the model needs to be selected while selecting this button otherwise nothing will occur). If you succeeded in doing so, your model will look like the above image.
Maya tends to make vertex colors look faded in its viewport, but don’t worry about it.
Now that you have imported your model and confirmed the vertex colors are still present, you may export your model from here as an FBX.
These were my parameters on export:
Now you’ve exported your model, you should have [filename].fbx!
We’re almost done.
Next you’ll need to get Simplygon, a free tool you can download here:
https://www.simplygon.com/ (We’re using Simplygon 8)
Simplygon is a professional tool used for optimizing high quality meshes often created in tools like Zbrush. Reason why we need simplygon is because our model currently looks like this:
Extremely high in poly count, and quite useless to be honest.
Anyways, once you’ve downloaded Simplygon (learn how to access is and use it on their site please, this tutorial assumes you have all the required tools) go ahead and import the FBX you’ve created from Maya or other tools. Below are the import options you should be selecting:
Make sure you’ve selected “Physically Based” and “256x256” texture size (it’s best to be as lightweight as possible for your game).
Get Zach Soares’s stories in your inbox
Join Medium for free to get updates from this writer.
If you succeeded in importing the file into simplygon, it should look similar to the below image:
(select the underlined button in the image to see the vertices)
Now, the last step:
Go to the right hand side of Simplygon and make sure you have Reduction and Material Baking active like the below image (in the “settings editor” tab):
Next, return to the “settings” tab, right next to the tab you were just in (still right hand side of the screen).
Make sure you’ve set your Reduction Percentage to a low number that works (30% worked best for me). The lower the number the more reduced your polycount will be (this is a trial and error process but bare with me.
Before you optimize your mesh you’ll want to make sure the vertex colors get transfered into a texture file, otherwise you’ll be stuck working with vertex coloring in engine, which isn’t ideal.
So open up your Material Baking tab, just below your reduction tab and make sure it looks like the below:
You can activate ambient, diffuse, specular or any other function that shows below but what you NEED to activate is “Basecolor” like in the image above. And be sure to have these parameters within it:
Toy around with any otehr variables but be sure “Bake Vertex Colors” is selected otherwise your vertex colors wont output as a texture for your model.
Once you’ve done all of this, hit the big yellow button below and your model should take a few moments to process and optimize.
If you did everything right, it should look like this:
The blue section that i’m highlighting is the “zone” where you’ll see your optimized mesh. If you’re within the white zone, you’ll see your unoptimized mesh.
On the top left you’ll see how many Triangles and vertices you’ve now got on your model. Hopefully you’ve got a bunch less.
Now that you got these results, go ahead and go to the top left and select File > Export > Scene
And save your file wherever you like, but make sure you’ve selected the FBX format, like so:
It should export both the model and a folder called Textures, containing all the textures you chose to keep.
You may rename your files however you like. But now you should have a completely usable model for your game which includes a texture file :)
The color texture will be called “basecolor” but you can rename that no problem. You’ll need to link up the texture to your model in unity to make the color visible….ANYWAYS, you should be good to go now.
ENJOY!
Written by Zachary Soares @Voxels





