Creating Models in Unity

By Shreya D'Souza

This tutorial goes through how to view models of medical data (in this case MRIs) in Unity. Viewing medical files in Unity has been explored, but I have yet to see a tutorial online that does not require several plugins that are potentially not compatible with all types of operating systems. The reason for this is that many medical data models are saved as .vtk files, which cannot be directly imported into Unity without using some sort of downloaded asset (the ones currently recommended include VTKUnity-MedicalViewer, which is only available on Windows).


This tutorial relies on the fact that Slicer allows users to save models as .stl files and assumes that a model has already been created in Slicer. To learn how to create a model in Slicer follow the following tutorials:

EXPORTING SLICER MODELS AS .STL FILES

  1. Open your Slicer File with the generated model

  2. Click on the "Save" Button

  3. Select any files you want to visualize in Unity, and ensure that their file type is set to .stl

Saving.mov
A quick note:Slicer allows for different parts of a model to be saved directly as .obj files. However, when imported into slicer, these parts are in the wrong orientation most of the time. Because the model I made is made up of 4 different parts, the best way to preserve the position of the parts relative to each other is to use Blender. If you have a model that only needs one file, then the quickest way to view it on Unity would be to export it directly as an .obj file and then change the orientation accordingly in Unity.

USING BLENDER

  1. Download Blender here

  2. Delete any of the default files under the collection hierarchy on the right side of the screen

  3. Import the four .stl files

  4. Export each .stl file as an .obj file, taking care to make sure that you are selecting the "Selection only" option on the right side of the save window.

Blender.mov

USING UNITY

  1. Download Unity here

  2. Create a new Unity File

  3. Add the newly-created .obj files to the assets folder of Unity

  4. Drag each .obj to the Sample Scene in the hierarchy. You should see a brain that is opaque and white.

  5. Click on Assets > Create > Material. This should create a spherical object in the assets folder.

  6. Open the inspector for the material object and change the white colour to your desired colour.

  7. Drag the material object in the assets folder to the object in the scene. This should change the colour of the object.

  8. When creating the material for the brain tissue, select the transparent rendering mode. Change the colour and opacity in the colour picker so that you can see the tumour segments within the brain tissue.

Unity Model.mov

PORTING TO THE YURT

Follow Loudon's Tutorial on how to port Unity to the YURT!