The new version of Magicavoxel came out today (0.97.1) with the much-awaited marching cube export. Marching Cubes is an algorithm that takes your voxel model and kind of takes the hard edges off so you get something which has a lot of 45 degree angles in it compared to before. It’s been in magicavoxel for a while but only as a render option; now you can actually export the models in this form for your games!

All good so far, but unfortunately the export is in .ply format. Ply is a format which was invented to store data from 3d scanners. It’s not a bad format and it easily allows you to store rgb colour data in all your vertices. Unfortunately you really find out who your friends among your software applications when you have a .ply file! Modo, Maya and many others simply won’t let you import this format. More importanly, engines like Unreal Engine and Unity won’t let you import it either.

One 3d modeler that does let you import .ply format is Blender so if you haven’t got that go and get it now from blender.org, or get it through Steam which will keep it nice and updated for you. It’s totally free and if you work with 3d models you simply have to have it installed, even if you model in something else.

Start up Blender and you’ll see the default scene. I normally delete the default cube so it doesn’t get in the way of my model. Do this by right clicking on the cube then pressing the delete key or x then clicking ok or pressing return. Import the ply into Blender with File->Import->Stanford (.ply). Looking good. Now right click on your object to select it. Then go to File->Export->FBX. Look on the left at the options under “Export FBX”. If you aren’t on the “main” tab, click that. Now make sure you check (tick) “Selected objects”. This ensures that you only export the object you made and not the light and camera (and cube if you didn’t delete that) that come in the default blender scene.

Now in Unity you can drag this fbx into the assets pane. Shock horror it’s all in white without your magnificent colourizations! This is fine and is due to the fact that there is no texture for your object: the colour is stored in vertex data which you can’t see in the default unity shader.

Now we need to get a vertex colour shader for unity 5. Get it from http://forum.unity3d.com/attachments/unityvc-unitypackage.144627/ The page talking about it is at http://forum.unity3d.com/threads/standard-shader-with-vertex-colors.316529/

Now if you know what you’re doing with unity you know what to do next: open up the asset that represents your 3d model, navigate to the shader part and select one of either Standard Specular (vertex color) or Standard (vertex color). Tada.wav colourized model, ready for some spoopy gaming action!