Extract & Reconstruct only the outer skin of a mesh

hi
I am trying to use these 3d meshes, to extract only the outer skin of the mesh and reconstruct it, i need to be able to extract in a way, if i project points on the mesh and only the outer side ones get used to make a new mesh, I am attaching the rhino file and the grasshopper script, where i tried, but its failing for more complex meshes.
is there a way to use pyhon, or other plugins, any inputs would be very much appreciated



i just want to construct these outer shell like geometry from the mesh imported.
EXTRACTION.gh (31.0 KB)
MESH TO EXTRACT.3dm (15.0 MB)

what do you specifically mean for “outer skin” in reference to a mesh that has openings?

like, for a concave shape, up to which point of that concavity you consider each location to be “inside skin” / “outside skin” ?

Take a look at my “Organ Pipe” algorithm (link below) which is designed to remove “inner splinters” of a mesh.

It may bee that “inner surfaces”, as perceived by humans - if that is what you mean - requires to modify the algorithm to reverse the direction of the probing “organ pipe” which is by default using the vertex Normal direction. Reversing it should be able to remove the “inner walls” of meshes with thickness (by defining the length of the pipe to a little longer than the thickest part of the mesh)

I say “inner” because, as @inno indicates, a mesh with thickness doesn’t have a defined “inner” surface, simply because all surfaces are, technically speaking, “outer” surfaces.

Anyway, my algorithm does to some extent view “inner” and “outer” as we humans perceive them.

I called my algorithm “Organ Pipe” simply because the code constructs a “probe” with the shape of an organ pipe, and it examines every mesh vertex (except for the vertex the “pipe” starts from) whether any other vertex is located inside the “organ pipe” shape. If the pipe has vertices inside it, those vertices are marked for deletion. That’s the whole idea.

The finetuning is about modifying the diameter of the pipe and the length of the tapered end of the pipe, which determines how sharply it cuts the mesh around holes with rounded edges from the "outside to the “inside” of the thickness.

You can also modify the LENGTH of the pipe to avoid it from intersecting with “overhangs” (the the vertices in the overhang would end up inside the pipe and so be marked for deletion, which isn’t what you want, thus, just shorten the pipe to the smallest distance or radius that exist under a overhang to avoid this).

If overhands are so tight (“narrow” or whatever to call it) that it will always ruins the result of the cleaning out of the “inner surfaces”, the solution is to segment (cut apart) the mesh and clean the separated segments and then joining them back again when done cleaning them.

The component is a C# Script component, and reversing the vector can be done in the code by modifying the direction to (pseudo code, I don’t remember the name of the vector off the top of my head, it was a while ago I wrote the script):

existingVector = -existingVector; // Reverse direction

//Rolf

1 Like

In some cases you can use Shrinkwrap offset outwards and then a second Shrinkwrap inwards to get rid of small details.

1 Like

I made an attempt using the OrganPipe cleanup algorithm.

In some cases it succeeded to, say 90%:

In the mesh with a deep hollow in it the pipe found excess intersections and thus excess deletions. It also couldn’t remove the “bottom”.

On the mesh with a hollow, I made a copy in place, and scale the copy down by -0.1 mm to have some “marrow” to simulate “inside” to have something to delete even when the “OrganPipe” would point out from the mesh through the openings in the sides.

The OrganPipe component had to deal with the meshes individually so as to allow for tweaking the input values to get the best & cleanest result.

At last, the Rhino file includes an example of a medical scan (a Scapula) which has “bone marrow” inside. That’s what the component was originally designed for. The OrganPipe algorithm typical cleans up such meshes very well. I mean VERY well.

ORGAN PIPE CLEAN - RIL-RE.gh (21.1 KB)
MESH TO EXTRACT - RIL-RE.zip (19.9 MB)

//Rolf

1 Like

by “outer skin”, I meant, imagine you wrap the whole mesh with a fabric and let it drape on the mesh, then you just cut out the openings from the shell, i have attached a sketch as a reference.

That’s really resourceful, great work, I would incorporate this methodology, and get back after testing on my catalogue of meshes…

Due to the way the “organ pipe” concept works, it should be noted that geometry that wraps around can cause the pipe to protrude and intersect with parts of the geometry that should be kept.

In order to understand how it works, It is important to look into the example I provided of a bit of a scapula which contained “bone marrow”.

  1. In that case you wanted to keep “both sides” of a geometry with thickness.

  2. Only the “marrow” inside the geometry was meant to be removed.

Referring to the two pipes (A , B) in the picture far below;

Case A: If the starting vertex (the peaky end of the organ pipe, is part of the mesh of the “inner bone marrow”, then the pipe, if long enough, WILL include other vertices, no matter in which direction it points (splinters of “marrow” can be pretty messy, and thus the vertices points in all directions).

And when the pipe includes one or more vertices, then the starting point/vertex of the pipe will be marked for deletion (eventually all such bone marrow will be cleaned out).

Case B: If the pipe starts from a vertex located on the “outer” surface, the pipe will just point out into empty space (including no other points), then that starting point/vertex will be KEPT.

When Case A and B is clearly understood, then one can tweak the input parameters to optimize the removal of unwanted vertices/mesh. For example:

  1. LONG PIPE: If the pipe is very long, then it may intersect with other parts of a mesh where the surface you want to keep is bending (typically “over hangs” etc). Then the algorithm will remove parts that you don’t want to have removed.

In such cases a shorter organ pipe may solve the problem.

If you have thicknesses that exceeds the “inner radius” or distance to an over hang, then the manipulating the pipe length will not solve the problem (in such cases in my cases, I could just split the geometry (segment it9, clean up the parts and then join the parts again.

  1. THICK PIPE: The thickness of the pipe matters since it does an point inclusion test from every vertex it examines. In tight spaces, the inclusions may be to many, leading to too much mesh removal. Reduce the radius of the pipe to solve the problem.

In meshes with thickness and holes (with rounded edges around the hole) the algorithm will cut open the edge, since the pipe will intersect with the hole-walls on the other side of the hole. If the hole-edge is rounded, at some point the pipe with point in a direction which misses the “other side” of the hole, but if the pipe diameter is very big, this cut out more of the rounded edge than if the pipe diameter is smaller.

The same principle applies to the Cone at the peaky end of the pipe. A longer cone means that the length of the peaky end is longer, and therefore that part of the pipe it has a similar effect as if making the diameter of the straight part of the pipe smaller.

If processing a mesh multiple times, one can “prune edges” (around holes etc) using different settings. For such I use multiple components connected after each other.

At last: What we mean with “inside” and “outside” of a mesh isn’t what the mesh itself thinks it is… Very tricky. :wink:

//Rolf

1 Like