A complete guide to importing from MagicaVoxel to Sketchfab

Back to overview

Hi! My name is Gabriel de Laubier, or Elbriga here on Sketchfab, I currently work as a lead artist with Vida Systems for Google Expeditions, and as a freelance 3d artist and voxel artist.

In this tutorial, we’re going to explore the different options for exporting a model from MagicaVoxel to Sketchfab.

So you’ve made a great MagicaVoxel model, and you rendered it in MagicaVoxel’s renderer: it looks amazing!

image09

However, when importing it into Sketchfab, it doesn’t look as you expected…

image11

Fortunately, there are some very easy tricks to improve the render of your model on Sketchfab, and even add effects like lighting and transparency without having to use any other 3d application.

In this tutorial, we will cover all the techniques to make the most out of your model with just MagicaVoxel, Sketchfab, and a 2d editing program like Krita, Gimp (both are free), or Photoshop. No special skills are required!

We will also discuss the other methods for exporting your model, like MagicaVoxel baking or baking in a 3d program like Blender, and what to expect with each method. However, editing or baking with Blender won’t be covered in detail, you can learn more about it in my previous tutorial, ‘Creating a 3D Star Wars scene in voxels using MagicaVoxel, Blender and VoxelShop‘.

About MagicaVoxel export

So, you’ve been hearing alot about MagicVoxel exports, formats, baking… it might be confusing to figure out what is the best way to export your model to Sketchfab with minimum hassle: after all, MagicaVoxel alone has nine different export formats, and it’s not always easy to know what does what.
Unfortunately, there is no “one solution” to this. The good news is, it doesn’t have to be that complicated. There are actually 3 solutions to export your model.

Exporting straight from MagicaVoxel in .obj format.

This method exports two elements: your model, and a texture containing all of the colors in your palette. All of the settings you might have set in the MagicaVoxel renderer will NOT be exported (lighting, emissive materials, transparency, metal…).

The model (mesh) exported with this method is not exactly a voxel model: it’s just the “shell” and all the voxels that are inside are not taken into account. The mesh and the texture work together in this way: each face of the mesh is “unfolded” in a specific place in the texture, and that is how Sketchfab retrieves the color information, and is able to display your model’s colors like you would expect.

Here is the model open in Blender, a 3d editing program. Each dot on the texture represents the faces that are “unfolded”, so that the program knows where to apply the texture.

image21

Baking your model in MagicaVoxel and export in .ply format.

If you find that exporting straight in .obj doesn’t give good enough results, you might want to go to the next level: baking. Baking is a process that saves the lighting information of a model in the mesh itself. Although baking is generally done with a texture, MagicaVoxel actually stores the lighting information in each vertex (point) of the model. When exporting a baked model from MagicaVoxel, you don’t get a mesh and a texture, but only a very dense mesh that contains all the color information.

There are several downsides to this technique: first, the mesh can be heavy if your model is big and complex. Second, MagicaVoxel only bakes the lighting from the Sky and Sun in the MagicaVoxel renderer, and the lighting from emissive materials and the transparency won’t be taken into account. It will also be harder to add lighting and transparency effects in Sketchfab without using a 3d software like Blender.

Here is a baked .ply model open in Blender. No texture is needed, but note how dense the mesh is.

image22

Exporting from MagicaVoxel in .obj format and bake and edit it in a third party program.

If you really want to go all the way and have the most advanced lighting and effects in your scene, the best solution is to import it in your favorite 3d software, like Blender, Maya, Cinema4d… And setup all the lighting, transparency and materials, then bake it onto textures and import it again into Sketchfab (learn more about it here).

While this often gives the best results, it is the most time-consuming and complicated method, especially if you are not used to using 3d software.

Here’s an example of a baked voxel model:

Walkthrough

Importing straight from MagicaVoxel

This is our voxel model in the MagicaVoxel editor:

image07

(You can dowload this model as a .vox file under CC-BY license here)

And this is our voxel model in the MagicaVoxel renderer, we’re going to try and mimic that look in Sketchfab. As you can see, emissive light and transparency are the key to the scene:

image09

Before we export our scene, there is one problem we have to solve. As mentioned earlier, MagicaVoxel doesn’t export a Voxel model, but a mesh, meaning the outer shell of your model. That is a problem when using transparency, because some faces that are inside your model will show holes, like so:

image27

To fix this problem, we’re going to adapt our model a little. Here, we just moved the glass windows so they are outside and don’t have any faces in common with other voxels. And when imported to Sketchfab, no more holes!:

image16

Now our model is ready:

image17

To export the mesh, just click “obj” in the “export” tab in the lower right hand corner in MagicaVoxel, and choose a folder in your computer. You’ll notice that MagicaVoxel outputs a .obj file, a .png file (the texture) and a .mtl file (the .mtl file contains the material information that links the .obj to the texture).

To import our model, just hit “upload” in the top right hand corner in Sketchfab, and drag and drop our three files:

image05

If all goes well, you should see your model with the texture applied. If the texture isn’t applied, just check the material settings:

image13

Now, our model looks a bit dull. First, we need some lighting effects. Emissive materials in Sketchfab don’t light the scene or cast any shadows, but we’re still going to be able to simulate a glow for those materials with the “bloom” effect.

For this, we will need a texture dedicated to emission. Remember that our mesh is “unfolded” with each face corresponding to its color on the png texture.

Let’s open the texture in Krita, Gimp, or any 2d editor:

image23

Next, paint all of the texture black, except for the colors you want to be emissive. Here we have the orange and yellow for the fire, the green for the screen, the neon color, etc.

image28

Save the texture as a separate file and import it in the emission tab of your material:

image26

Still doesn’t look like much. We need to enable the bloom post-processing filter. Much better! You can adjust the bloom settings and the emission strength in your material to your liking.

image30

Next, we need some transparency. Like we did for the emission, we need to prepare a texture, so open your .png texture again:

image23

Let’s paint it black, except for the color(s) we want transparent, and save it as a separate .png image:

image29

Next, let’s import it in the “transparency” tab of our material. DON’T FORGET to set the “Format” setting to “Luminance”. Um, this seems to do the exact opposite of what we want…

image12

… so we need to check “invert”, and ta-da:

image06

Before we go further, let’s adjust a few settings in the general tab. We’ll set the background to a flat color, and we’ll reduce the field of view:

image02

Next, it’s time to add some lighting. In the lighting tab, you can disable the environment and enable lights. We’ll enable only the first light to begin with, and choose a “spot” light to simulate the lighting from the neons:

image01

Then, we’ll simulate the ambient lighting in the room with a point light:

image00

And finally, we’ll add a direction light:

image04

We’re done with lighting!

image08

Finally, Sketchfab offers a wide range of post-processing effects that you can use. My only advice would be: don’t overdo it. However, for this scene we used almost every filter:

  • Animated noise will add a nice effect to our glowing lights
  • A little depth of field will look great if people zoom in your model
  • A little sharpness can look great if used in moderation
  • Chromatic aberration simulates light distortion through a camera lens, once again, to use in moderation
  • The vignette effect adds a little focus to the center of the image, but don’t overdo it.
  • Setting tone mapping to “filmic” will make the scene much more dramatic, you can also play with the exposure slider to adjust the brightness of the scene.

And now your model is ready to publish, and share!

Baking your model in MagicaVoxel

If your model doesn’t need emissive lights or transparency, it’s probably a good idea to use MagicaVoxel baking, as it adds some nice looking shadows to your scene. However, it only takes into account the “sky” and “light” settings:

image14

To bake your model, hit “bake”:

image25

This exports a .ply file, that contains all the color information. The following compares the same model with and without baking, note the shadows on the left model:

image15

To import into Sketchfab, we just need to drag and drop the.ply file as we did for the .obj. The model should show up with all the colors and shadows already, however, it looks a bit dull:

image24

Since our model is baked, we don’t need to use the “lit” renderer, let’s switch to “shadeless” instead, and choose a background color and an appropriate field of view:

image18

Finally, we’ll adjust post-processing filters as we did for the previous model:

image31

If you need some emissive and transparency settings, you’ll need to edit the model in a 3d modelling software, like Blender. However, this is a little more complex and we won’t be covering it in detail in this tutorial. If you are familiar with a 3d modelling software, all you’ll have to do is select the faces you want to be emissive/transparent, and separate them into another mesh. Then, when importing into Sketchfab, you’ll be able to set values for emissive and transparency settings for each separate mesh. To learn more about using Blender to import MagicaVoxel models into Sketchfab, this tutorial might be useful.

Our finished Sketchfab model:

I hope this tutorial was helpful, if you have any questions, leave a comment below!

Feel free to ask me anything or request more tutorials on Twitter, and you can see more of my work on here on Sketchfab, my website, Facebook or ArtStation.

Thank you for reading!

About the author

Elbriga

I'm Gabriel, a graphic artist from Paris. I am a Sketchfab Master. My main interests are voxels and NPR models.



No Comments

    Related articles