Removing Small Features

 
< previous page next page >

Within this tutorial, we are going to use RapidCompact CLI to remove small features which are not desired in the optimized output. Small Features can be any unconnected geometry which is equal or smaller to the relative (to the bounding box of the whole mesh) or absolute (in used unit system) target value.

Table of Contents

Getting Started: What is considered a small feature & how does the target value set-up work?

 back to top

Often times when a model is automatically generated, for example from point clouds, there can be a lot of noise and as a result small mesh features all over the place which are tedious to clean up manually. Likewise meshes coming from CAD or other construction data also contain several small features such as screws; For those types of inputs an absolute target value based on the unit system can be advantageous for getting rid of certain types of detailed micro meshes and structures in an efficient and fully automated way.

Non-coherent meshes When using the --remove_small_features command with a non-coherent mesh the results will not behave as expected. As an example we can have a look at a 16-bit glTF File (the mesh here is split into parts, each not exceeding 65K vertices). The mesh would be not coherent and thus the feature might remove more or less parts dependent on the splitting.

Removing the small features

 back to top

We will now remove a small feature on a simple example mesh from a 3D scan of the roman statue erato (courtesy of Geoffrey Marchal), which you can download here.

After unpacking the OBJ file try now to load the model and first render an image to see what it looks like:

    rpdx -i erato.obj --render_image erato.png
    

You can see that RapidCompact CLI rendered a simple image and we can identify some meshed noise from the scanning process in the bottom left corner. Let us now execute the command and remove the small feature we identified before:

    rpdx -i erato.obj --remove_small_features 10 --render_image erato-optimized.png
    

As you can see the small feature was removed and the rendered image adjusted the camera slightly to fit the new bounding box. In this case it would not make a difference if we choose the absolute target of 10 or a relative target such as 10% because of the simple input of just one main mesh and one simple feature. Let's have a look at a more differentiated input file so that we can identify differences between absolute and relative target values:

We can simply re-use the cassini.stl file from the previous tutorial:

As you can see the mesh consists of several smaller parts which are not necessarily connected. In this case we will get different results when choosing absolute or relative (%) target values. Let us start with a target value of 1 which in this case is only dependent on the internal scale of RapidCompact due to the missing units in STL or OBJ format:

    rpdx -i cassini.stl --remove_d --remove_small_features 1 -e cassini-1.obj
    

We were able to remove several parts which have a maximum axis length of 1 or lower. Let us try now to remove parts which are equal or smaller to 1% relative to the bounding box:

    rpdx -i cassini.stl --remove_d --remove_small_features 1% -e cassini-1%.obj
    

As you can see the results are pretty similar. However with the last method we removed a few more parts due to the relative size target (1% of the bounding box in this case is larger than the unit 1).

Using the Setting instead

 back to top

Instead of using the command to check for invisible geometry, it is also possible to use the functionality as a setting (string:REAL or REAL%) "compact:removeSmallFeatures":

     rpdx -i cassini.stl -s compact:removeSmallFeatures 5% -c -e result/cassini.stl
	
Tip Note that this setting only works in conjunction with the compact command. If no decmiation is desired please use a face or vertex target of 100%. for example:
rpdx -i cassini.stl -s compact:removeSmallFeatures 5% -c f:100% -e result/cassini.stl


< previous page next page >