Within this tutorial, we are going to use RapidCompact CLI to remove invisible interior parts of a mesh. If the input model has a high amount of interior geometry, which for example CAD files often have, the resulting model will be significantly smaller than the original file, but visually identical when viewed from the outside.
To get started with this tutorial, we will need to have a 3D model to play with. Please go ahead and download the cassini model (courtesy of NASA), which we will use throughout the tutorial, here. Initially, when loaded into some 3D viewing tool, the data should look like this:
To apply the culling of interior parts, which will reduce the mesh further, apply now the following command on your command line (for example, Windows PowerShell):
rpdx -i cassini.stl --remove_invisible_geometry -e result/cassini.stl
This will create a new directory called result, and the resulting STL file will be stored there. As you can see by checking the size of the resulting model, the optimized data set is a lot smaller than the original data. With an x-ray rendering, we can see the difference in the 3D mesh and interior geometry before and after the optimization. This is how the original looks like:
As you can see in the following view of the optimized model, the cassini model has some interior parts which can be removed to improve the overall polycount and thus filesize:
Note how the cube structure and other smaller interior parts were completely deleted, while other mesh-parts were partially removed.
Using the --remove_invisible_geometry command helps with optimizing the dataset further for visualization or purposes where the interior parts are not necessary. However, it is not a trivial decision when to use the operation together with other mesh optimizations, such as mesh decimation. For example, it is possible to use the command either directly on the input mesh, before applying decimation, but we could also decide to remove invisible geometry after the decimation, on the low-poly output file. In many cases when importing big data sets, it can be much more time-efficient to use the command only on the already decimated low-poly version. An example command line could look like this:
rpdx -i cassini.stl --duplicate -c 20% --remove_invisible_geometry -e result/cassini_compact.stl