Creating Surface Meshes

Surface meshes in a .stl file only contain the vertices and edges of the surface. If we want to do more sofisticated rendering in SOFA, such as adding texture to an object, we need to use a file format that allows extra information. For textures, this extra information is UV coordinates that describe the mapping from points on the surface to points in a texture file (e.g. a .png image).

Requirements:

  • Blender

  • template mesh (for example a .stl mesh of the desired object)

Creating an .obj file with texture coordinates

  1. Open Blender

  2. Import the template mesh:

    • Click File -> Import

    • Select the correct mesh file type

    • Select your template mesh

  3. Switch the active workspace to UV Editing in the top bar.

UV Workspace.
  1. Change the view mode to Edit Mode (Step 1 in the image below)

  2. Click Select -> All (Step 2 in the image below)

  3. Click UV -> Smart UV Project and leave all settings in the popup as default (Step 3 in the image below)

UV Unwrap.
  1. Export the mesh: Click File -> Export -> Wavefront (.obj)

  2. In the file menu, on the right:

    • Under Geometry select Include UV's

    • Under Transform you might have to change Forward and Up in order to get the orginal orientation.

  3. Finally press Export OBJ

File Export.

Creating an .obj file with higher resolution

This is achieved by subdividing the polygones of the mesh.

  1. Open Blender

  2. Import the template mesh:

    • Click File -> Import

    • Select the correct mesh file type

    • Select your template mesh

  3. In the layout workspace swith to Edit Mode and click Select -> All

Layout mode.
  1. Right-click the liver

  2. Press Subdivide

Subdivide.
  1. You should be able to see the changes (more vertices)

Subdivided Liver.
  1. Repeat the process until you are happy with the number of vertices.

  2. Export the mesh as .obj file following the steps above.