Wednesday, April 15, 2009

How to remove internal faces with MeshLab

A very common situation that often arise the cleaning of a model with a detailed interior in which you are not interested in (and you want to remove it once for ever!). For example consider this nice LEGO model: 200k faces. Most of the faces are hidden inside the model, used to describe the internal pieces and pegs: not very useful in most cases. We can remove them with MeshLab.

After starting the filter color->vertex ambient occlusion over the mesh (and after waiting a few seconds) we have computed both a per-vertex gray color and stored for each vertex an attribute with a occlusion value. Side note: MeshLab has a general purpose per vertex and per face scalar quantity that are used and interchanged by many different algorithms with a variety of different semantic; we call this scalar quantity "quality" for no good reason (lazyness), it is a generic scalar quantity, it could be occlusion value (like in this case), a geodesic distance from border, gaussian curvature.

Second note: Ambient occlusion greatly enhance the perception of 3D shapes! Nowadays everyone recognizes it, but a few years ago not a lot of people was really aware of that (I am a proud user of AO since 2001 for nice renderings of Cultural Heritage stuff :) and, more recently, for nice renderings of molecules ).

Back to the topic of removal of internal faces.

We now can exploit this per-vertex occlusion value to select all the faces that have all their three vertices with a very low occlusion value. That means that we remove all the faces that has no visible vertices. This is not an perfect solution, there are easy counter-examples where this approach could remove visible faces (but with hidden vertices): in most cases it works wells but a bit of caution is always recommended.
In the side figure you can see the select by vertex quality filter in action with the all the selected internal faces: 130k faces out of 200k were totally internal and can be safely removed leaving just 70k faces.


Lily said...
This comment has been removed by a blog administrator.
Mark said...

Great stuff, I love this program, it is better than 3D Max.

viagra online

JonnyRo said...

It seems like it would be handy to use multiple lights on tricky areas. How can I add additional lights via meshlab?

Seamo66 said...

I have an stl file which is composed of contiguous cubes, like this:

I need to remove all the shared faces of the cubes, so the structure become one continuous solid.

Note that I cannot just delete ALL the internal structure. The object is hollow and its internal structure must be maintained. I just want to delete the shared faces of the adjacent cubes.

Is there a way to do that in MeshLab? Thanks,

monstercolorfun co said...

Oh my god i can't believe it's not possible to take a mesh with overlapping vertices and resize the vertices so there are no overlapping vertices, and the boundary of the object stays the same. :D

Thomas John said...

How to extract 3D models from mobile games?
Automatically fix 3d model

Linda van Breemen said...

Hi there,

I am wondering... How can I find what is described in the current meshlab version???

Ken Kaiser said...

In the most recent it isn't too different, but not exact.

1. Filters > Color Creation and Processing > Ambient Occlusion. Then applying default values worked for me.
2. Filters > Selection > Select by Vertex Quality. The small picture gave me some hint, Min quality: 0 Max quality: 0.1, the preview checkbox shows what you will select in red while you adjust.
3. Filters > Selection > Delete Selected Faces and Vertices.

Bravo on this great software, I can open a file with 2135730 faces and it opens in 15 seconds and I can edit at 20fps. Just started but it seems great for prepping STL files for 3d print.