← Go back

Fixing holes in 3D-Models exported from MagicaVoxel

When exporting models from MagicaVoxel and importing them into Unity you can sometimes end up with some flipped normals on some faces of the 3D-Model.
This will not be visible on the model itself but will be immediately visible when using shadows.
You could manually go through all faces in a 3D-Modeling software like Blender and fix the normals. But when using complex models this can quickly get too much of a task. Here is an example of a broken shadow using a MagicaVoxel model in Unity: Example of the broken shadows Now to fixing this without repairing every normal on the model.
First you should take a look at the settins of your light source. In my case it is a directional light.
My settings look like this: Screenshot of the current settings of the directional light Take a look at the configuration of the "Realtime Shadows" for the shadow type "Hard". As you can see our "Normal Bias" is set to 0.4. Increasing this value will increase the holes in our shadows. So if we set this value to 0 the gaps in our shadows will disappear. Here is how the shadow of the same model looks like with "Normal Bias" set to 0. In most cases this will not affect the look of the rest of the scene. Example of the fixed shadows

A word on directly importing models form MagicaVoxel

MagicaVoxel does not optimize (or at least does not do a good job at it) the exported models. What you should do, especially with complex models, is run them through a 3D-Modeling software like Blender and optimize the meshes. I will link a little guide for that here once i had time to write one.

Optimizing MagicaVoxel models in Blender