# Importing 3D Models

## 1. Importing Complex Models (i.e.: 3D Scans)

This is a simple workflow I use when transforming high-poly models to voxel models.

### Problem

You want to import a 3D scan model into MagicaVoxel.

![A 3D scan from threedscans.com](https://2848349403-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1GLjicm2G4TkYoBqY2%2F-M3k_bKCC1Elc3gZiI3d%2F-M3kd1XfQQERQrWackVq%2Feinstein.png?alt=media\&token=906c8456-68ae-4e77-9f18-949a54b0c825)

### Solution

I use a 3-steps procedure:

1. Simplify the mesh through [MeshLab](http://www.meshlab.net/)
2. Create a *.vox* model through [FileToVox](https://github.com/Zarbuz/FileToVox)
3. Open the file in MagicaVoxel

#### Simplifying the Model

**MeshLab** (<http://www.meshlab.net/>) is an amazing open-source tool for processing and editing 3D triangular meshes. What we need here is its ability to cleanup and reduce triangle numbers.

* Download and install the software
* Open the software
* Import (*File > Import Mesh*) the 3D mesh you need to simplify

![The imported mesh in MeshLab](https://2848349403-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1GLjicm2G4TkYoBqY2%2F-M3k_bKCC1Elc3gZiI3d%2F-M3kdw2SgNkkLKTuFa7A%2Fmeshlab_01.png?alt=media\&token=99d5e343-459a-4523-afec-be4bc7f04c34)

You are now ready to simplify the model:

1. *Select, from the main menu Filters > Remeshing, Simplification and Reconstruction > Simplification > Quadric Edge Collapse Decimation*

You will get the following simplification window:

![The Quadric Edge Collapse Decimation window](https://2848349403-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1GLjicm2G4TkYoBqY2%2F-M3k_bKCC1Elc3gZiI3d%2F-M3kf8rer1LbE2zacWTB%2Fmeshlab_02.png?alt=media\&token=b17fa83a-d50e-463d-955f-9d4a61fe812b)

For our purpose, we just need to decrease the number of faces

* Lower the *Target number of faces value* (it is usually already halved) or use the *Percentage reducion value* (0 to 1)
* Click *Apply*
* Repeat the process until you are happy with the results
* Export the mesh in your favourite format

![The simplified model](https://2848349403-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1GLjicm2G4TkYoBqY2%2F-M3koQnsPk6HHB2T0oFt%2F-M3krsrgyxymZdAjdCzs%2Fmeshlab_03.png?alt=media\&token=2fc401b5-8536-4cba-a32a-30bae97d9862)

#### Create the .vox Model

For this step you will need a command line tool called **FileToVox** (<https://github.com/Zarbuz/FileToVox>):

* Download the tool from the GitHub repository
* Unzip the package in your file system
* Execute the FileToVox command:&#x20;

  ```
  ./FileToVox.exe --i mymodel.obj --o mymodel
  ```

Note: if you are not comfortable with the commnad line tool, you can use FileToVox-LazyGUI (<https://github.com/patrikroy/FileToVox-LazyGUI>).

![The FileToVox LazyGUI tool](https://2848349403-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1GLjicm2G4TkYoBqY2%2F-M3koQnsPk6HHB2T0oFt%2F-M3ktewePB4yhauDQ-Iq%2Ffiletovox-lazygui.png?alt=media\&token=e80accbf-9cf0-4d36-b568-629fc33e9df8)

#### Open the File in MagicaVoxel

You are now ready to open the file in MagicaVoxel.

![The model opened in MagicaVoxel](https://2848349403-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1GLjicm2G4TkYoBqY2%2F-M3koQnsPk6HHB2T0oFt%2F-M3kuX06lCjS5DQLiwrj%2Fmagicavoxel-import.png?alt=media\&token=c204e387-a236-4542-a93b-c73ae5d76e49)
