TPW Workflow Series: Post-processing 3D models
In this TPW workflow the post-processing phase of 3D scans is described. The successful alignment of the separate scans have been fused to one single mesh, the 3D model, and has been exported to OBJ. The OBJ is often too large (around 1GB) to run in analytical software such as Meshlab, CloudCompare or Paraview, and need therefore to be reduced to a workable size. In other words, the mesh has to be simplified. Simplification is also necessary for the online display of the models in (proprietary) platforms such as Sketchfab. When 3DHOP is the preferred solution to display models, however, the 3D models do not need to be simplified, as 3DHOP is able to represent high resolution models because it uses the NEXUS multi-resolution format.
TPW uses the open source application Meshlab to simplify the models and to export them to other formats. In the TPW workflow Democratising data we explain why it is important to simplify 3D models and export them to multiple formats.
Step 1: Download Meshlab. Open Meshlab and drag the OBJ into Meshlab, or import the 3D model under ‘File’ >’Import mesh’.
Step 2: Go to ‘Tools’>’Options’, and the ‘Global Parameters Window’ pops up. Scroll down until you see the row ‘MeshLab::System::maxGPUMemDedicatedToGeometry’. The standard is 350 (MB of RAM), which is too little. Change it to the RAM you have on your graphic card. This will improve the smooth handling of the mesh.
Navigating in Meshlab
Rotating the object: left mouse button.
Zooming on the object: mouse-wheel or alt and left mouse button.
Panning (moving the object): hold ctrl and left mouse button.
Make sure the object remains in the Trackball (the sphere), otherwise the object does not rotate around its axis.
Right of the view port is the project window. To turn off the texture (photo layer) choose the cylinder icon, then go to ‘Texture Coord’ and choose ‘Off’. This enables full control over the geometry.
In the palette above the view port, there are options to display the object as a pointcloud (the dots icon) or as a wireframe (the icon of a cylinder with triangles). You can also make snapshots of the object with the little camera icon.
The simplification process
Go to ‘Filters’>’Remeshing, Simplification and Reconstruction’>’Simplification: Quadric Edge Collapse Decimation’.
Check the ‘Preserve Topology’ box and leave the rest as it is. Press ‘Apply’. The first time may take a while. After decimating close the window.
Go to ‘File’>’Export Mesh As’. Add DEC to the file name (for example NameDEC1.obj). Choose in the drop down menu ‘Alias Wavefront Object’ (OBJ). Hit ‘Save’ and in the next window ‘OK’. Although the file needs about 4 or 5 cycles to be decimated to the desired file size, it is wise to export/save the project after the first decimation. There are few reasons why you should do this. The first reason is that Meshlab crashes regularly (although the recent 2020 release is much more stable). Secondly, Meshlab sometimes produces a weird, undesired output after the second decimation cycle.
Now repeat the decimation process 4 to 5 times, depending on the resulting file size: the should be between 150-200 MB. The target should be around 1.100.000 faces. Do not try to fill in this target in the Quadric Edge Decimation window the first decimation time, because Meshlab will crash.
Of course you could decimate until 25-50MB. Save this file as DEC2. Extra reduced meshes are useful to publish in PowerPoint, PDF and online, depending on the platform/viewer.
Actually, the first thing you should do when opening the original OBJ, is to export it to PLY. Indeed, HP Scan Pro has PLY export functionality as well, but HP finds it difficult to convert to vertex colors.
Go to ‘File’>’Export Mesh As’. Choose in the drop down menu ‘Stanford Polygon File Format’ (*.ply). Hit ‘Save’ and in the next window ‘OK’.
STL is a widely used format as well, especially when texture is not required, such as for 3D printing. DAE has the advantage that it embeds the texture in the fil, saving copy-pasting mtl and texture files, with the risk of loosing the textures in the process. However, it takes a lot of time to export to DAE and it produces huge file sizes. TPW exports only in special occasions to these formats.
Other functionalities in Meshlab
Sometimes meshes have ‘noise’: random, isolated points or pieces that are not connected to the object. To remove this noise, go to ‘Filters’>’Cleaning and Repairing’>’Remove Isolated Pieces (wrt diameter)’.
Other cleaning options are: ‘Filters’>’Cleaning and Repairing’>’Remove Duplicate Faces’ and ‘Filters’>’Cleaning and Repairing’>’Remove Duplicate Vertices’.
If you want to improve the visibility of features, the easiest and fastest way of doing this is the application of so called ‘Shaders’. Go to ‘Render’>’Shader’>’Radiance Scaling’. This shader enhances all topological features. Just play a bit with the settings.
Filters enhance features as well. These can be found under >Filters>Color creation and processing. Particularly the filters ‘Colorize curvature’ and ‘Ambient occlusion’ are interesting to play with.
The next step
The next step is to keep a record of the process of recording and processing the scans. You can find out how in this TPW Workflow Series.