Removing Small Features

< previous page next page >

Within this tutorial, we are going to use RapidCompact CLI to remove small features (mesh lumps) which are not desired in the optimized output. Small Features can be any unconnected geometry and will be flagged for delete in case their size is equal to or smaller compared to the overall bounding box size of the whole input model. The value can be specified relatively in % or absolute. For example a value of 10% applied on an input asset with a total bbox size of 1,1,1 would delete everything which is equal or smaller to 0.1 in their biggest dimension (x,y,z). Similarly a value of 0.2 would delete everything which is equal or smaller to 0.2 in their biggest dimension (x,y,z).

Table of Contents

Name Type Default Valid Range Quick Description
compact:removeSmallFeatures String or % percentage (relative to the scene's bounding box) or absolute value (in scene units), defining the largest mesh lump bbox sidelength considered small

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.

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 use the following command to get information about the size of the bounding box:

    rpdx -i erato.obj -p

You should now see a long list of attributes, the most important line would be the fourth one:

	"bbSize":   [19.0059, 37.6387, 20],

In case we want to use a percenage value we could already have judged from the screenshot or an inspection of the model which value would be fitting (example: 10%). With the information of the total bbox size we can now also try to be a lot more precise, which might not make much sense in this simple scenario, but might come in handy in cases where we have exact knowledge of the dimensions of the features, for example with tessellated CAD or DCC data sets. Let us now execute a command including the setting and a render command and remove the small feature we identified before:

    rpdx -i erato.obj -s compact:removeSmallFeatures 10 -c -e erato_optimized.obj --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 and adjust the decimation target value to 100% for better comparison:

    rpdx -i cassini.stl -s compact:removeSmallFeatures 1 -c f:100% -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 -s compact:removeSmallFeatures 1% -c f:100% -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).

< previous page next page >