Grasshopper

algorithmic modeling for Rhino

Best Uniform Remesher For Patterning Organic Suraces

MeshMachine, a part of Kangaroo 1, is prone to blowing up as you add more iterations, assuming you can get it to work at all in an hour or more. It has ability to relax a mesh, and to fix in place sharp edges fairly well, but since it has such kinetic behavior, seemingly optimized for speed on small test systems, it doesn't give the most uniform mesh, most of the time. If you take the dual of the triangular mesh, you see lots of squares and octagons.

I also had to rely on MeshMachine to refine Cocoon marching cubes organic surfaces, since the refine component of Cocoon blows up even worse than MeshMachine, which it is black box based on, with five completely undocumented parameters.

So I searched for many days for various scriptable libraries, all of them in C++, and not only did few work well as software, they gave lots of squares too, meaning they are poor at dividing up a surface evenly, since those four triangles per square dual shape are so small of an area. I want something more like a beehive or a fly's eye.

The standard library for geometry out there is CGAL, and it would be nearly impossible for most Grasshopper users to install it, since there are no binaries of the latest versions, and you have to compile several smaller libraries as you spend upwards of many full days searching forums for answers to errors in just installing it. And who knows how good of meshes it makes? I can only test it in C++, fairly easy enough, and may be able to compile a remeshing function that I can call from the command line which I can upload as a working binary, that will write the output to disk. That means I could call it from Python, anybody could, since Python is so simple. But what I can't do after the installation is get Python bindings to work on Windows. That's just broken completely.

The breakthrough, after struggling through truly terrible Windows utility programs, was finding OpenFlipper, a geometry plug-in development platform. It even has a Grasshopper-like nodal editor to build scripts, but that's so far limited. The normal scripting commands are easy to pick up on though, so I wrote Grasshopper wrappers for three remeshing strategies that result in no squares or even octagons and above, only pentagons, hexagons and septagons in the resulting dual of the triangle mesh. I used Python to write an input mesh to disk as an STL, then I create an OpenFlipper script on the fly, also written to disk, then I have OpenFlipper run and I read in the resulting STL file back into Python and spit out a Rhino/Grasshopper mesh again. It briefly brings up the GUI of OpenFlipper then closes it to put you back in Grasshopper, since the command-line-only option seems to be broken and this allows all commands to run, not just blind capable ones.

The Python scripts are simple enough to modify on your own to add more OpenFlipper commands.

Just download the Windows program here, the "Staging" version being the desired beta version with more features:

https://www.openflipper.org/download/

Install it in the normal Programs Folder. In the future you will have to edit the path in Python with updated OpenFlipper version numbers, in line 35 below. [See troubleshooting posts below about right clicking on Rhino.exe and OpenFlipper.exe to set the Compatibility tab checkbox in Properties to "Open this program as administrator." and to also check that OpenFlipper's directory matches what's in the Python code that you can view by double clicking the Python component on the Grasshopper canvas.]

None of the three strategies automatically preserves hard edges, so for those the adaptive strategy is often best.

Use Weaverbird Dual to gain quick access to this blissfully better distribution of cells on a surface than the "alien slime" of random Voronoi diagrams.

These will not smooth out original large facets from crude meshes, so subdivide those first using Weaverbird. I included a source meshing group, to apply to NURBS polysurfaces, too, since OpenFlipper won't import surfaces, only meshes.

Such ideal meshing that lack tight little square areas in the dual will also afford highest quality 3D tetrahedral meshes. I ported Tetgen to Grasshopper too, in the past, for that, and that also affords 3D polyhedral cells.

Views: 11248

Replies to This Discussion

Impressive.

Monolith marching cubes on two intersecting mesh surfaces, to form thick, smoothly blended plates, then remeshed with OpenFlipper (Uniform method), then dual found using Ivy, and thinned with Ivy, then offset to a solid in Rhino and subdivided with Weaverbird:

It plays nice with IntraLattice too, so instead of having to subdivide to smooth, you must remesh. Intralattice forms polygons on the ends of each straight wire, then calculates a convex hull at each vertex, giving a low poly fattened truss from lines, and it works not just on shells, but any arbitrary 3D net, so now I can start connecting things between shell faces and have them become 3D printable single meshes. Way faster than marching cubes for such detail work, as in doable instead of impossible.

Remeshed with OpenFlipper:

Weaverbird Loop Subdivision immediately after IntraLattice:

The remeshing code is quite simple textbook operations of splitting long lines and collapsing long ones, along with tangential smoothing to wander vertices towards the middle of their neighbors:

https://www.openflipper.org/media/Documentation/OpenFlipper-2.0/a02...

Does the openflipper remeshed mesh dual can result in mesh consisting only of hexagons?

Almost! Topologically that's even impossible. You need at least twelve pentagons to enclose a topological sphere, and likely a bunch of septagons to enclose a topological doughnut and that's with just one hole. This is as close as you can get, I think, since there are only 5, 6 and 7 sided dual polygons. Nor are those particularly flat either, more like fabric.

A torus can actually be covered with all hexagons with no irregular vertices, because it has a genus of 1. The edge lengths would have to be rather uneven though (with these remeshing methods it is always a trade off between regularity of valences and equality of edge lengths).

Also - in the example shown from Meshmachine above it looks like you must have the 'Flip' option set to angle based. Switching this to valence based gives far fewer valence 4 vertices than that (though still more than OpenFlipper, so they are doing something different, though the algorithm looks very similar). Skimming through their code, it seems OpenFlipper is using exactly the same criterion for choosing which edges to flip as the valence based option I have, but the smoothing used looks like more than simple neighbour point averaging though - there is some area weighting going on there. Could be worth trying out.

Interestingly, it has been shown that all triangular meshes can actually be converted into only 5-6-7 valences. I often thought it would be nice to try implement some of these substitution rules to guarantee no 4s or 8s.

Glad I posted a link to the source code! My main issue with MeshMachine is that is blows up so easily in some cases.

I also note that your alternative version that accepts code as input, I can't get to run on Windows 10:

https://discourse.mcneel.com/t/gh-script-or-component-for-isotropic...

Something from MeshMachine, the usual "1. Solution exception:Object reference not set to an instance of an object." error.

Here is MeshMachine with Flip = 0:

Any idea how it stacks up in result against zbrush remeshing / dynamesh

ZBrush is boring for meshing except for the extreme best-in-the-world ZRemesher command that does feature-aligned curvature adaptive quad meshes. Those convert to NURBS well, too, via T-Splines smooth mode conversion. Their method seems to be a trade secret since they magically avoid all manner of spiral artifacts through doughnut holes in thin mesh bodies. Dynamesh is also quads, but noisy and random little ones, and ZBrush triangle meshes from decimation or export as STL are rather boring, though efficient.

Yes, that ZRemesher is pure magic!

Affords highly regular tetrahedral meshing of the volume inside bodies, via wire thickening with IntraLattice, after using my Tetgen parser for Grasshopper.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service