Bulge Free Metaballs And Metalines?

I've been casually searching for a "normal" metaballs routine for Rhino for years, but what I find are force field based calculations of an isosurface that are spread out in space too much beyond their ideal surface so they add up where lots of points or lines cluster and create rather unintuitive bulges form a 3D modeler's perspective, here done with Millipede's Geometry Wrapper:

I've learned to do marching tetrahedra or cubes in Python to create the surface as needed from a implicit ( f(x,y,z) = 0 ) mathematical equation based on raw trigonometry but am not yet sure how to define an equation for Rhino user created input items like this or find a way to make marching cubes accept such input let alone one that doesn't treat each geometry item as an electric charge with so little decay.

This would afford an old school "organic" modeling paradigm that T-Splines replaced, but the T-Spines pipe command can't do nearby lines right either, which just makes overlapping junk. Metaballs and lines are not as elegant in that there is a real "dumb clay" aspect to the result that affords little natural structure beyond just smoothing, but still, if it works at all that beats T-Splines, and then I can feed the crude mesh result into Kangaroo MeshMachine to afford surface tension relaxation that will add elegant form to it.

I need both quick hacks and some help on how to deeply approach the mathematics of the required isosurface, now that I can think in Python better than ever.

I got a hint the other day here, about using a different power of fall-off but am not sure how to do the overall task mathematically:

"and just as with point based potentials, one can use different power laws for the distance, function, resulting it different amounts of rounding at the junctions. Below is with a 1/d^3 law for comparision with the above 1/d" - Daniel Piker

http://www.grasshopper3d.com/forum/topics/meshes?commentId=2985220%...

He also included this link about bulging:

http://paulbourke.net/geometry/implicitsurf/

Am I supposed to create an actual implicit equation for my assigned points and lines and use that with marching cubes to surface it? If so, how do I define that equation, at all, and then how to control bulging too?

Load Previous Replies
  • up

    Nik Willmore

    Here is the first user friendly Nik's Metamodeler, a Rhino modeling aid based on non-bulging metaballs, metalines and pseudo-metasurfaces (via isocurves as more lines), that grabs anything on a layer you can specify in the Geometry Pipeline components, though it's set to grab all layers initially.

    Preview mode shows how badly the marching cubes Geometry Wrapper (David Stasiuk) is acting up:

    The 3D aliasing issue can create real final artifact bulges along angled surfaces which eventually requires turning the resolution (cube size) down lower for a slow final result. With settings that are quite fast, you can leave the Grasshopper solver on instead of disabled, but when the going gets slow, just disable it and initiate single solutions via the Recalculate menu item.

    Various display modes may be preferred, and it may help to set Display Options... (viewport menu) to make lines and points display thicker.

    Extreme levels of MeshMachine (Daniel Piker's Kangaroo) gives elegant tension membrane smoothing:

    • up

      Nik Willmore

      Having now nearly modified my port of marching tetrahedra to Grasshopper Python (see: http://www.grasshopper3d.com/forum/topics/meshes ), to do metaballs, the ones that do not cause bulging since they have no mathematical falloff function, just an abrupt switch of field from zero to one in a way that somehow avoids nearly all bulging despite fields still at least arithmetically adding up where balls cluster....

      I have newfound appreciation of David Stasiuk's Geometry Wrapper VB script. First of all, marching cubes actually gives a smoother result than tetrahedra, despite tetrahedra having a reputation of being "more uniform," in that tetrahedra can give aliasing that appears not as regular bulges but as sharp pyramids:

      This can cause the smoothing step to end up with a somewhat directionally warped result.

      But more so, Stasiuk's Geometry Wrapper, rather than bafflingly using a Grasshopper data tree as I thought and was disturbed by since scripting was my escape from those altogether, he is invoking a very fast special feature of Rhino via the Rhinocommon RTree feature that can search 3D space very efficiently, and thus his script is much faster than my Python version that is RTree ignorant. Here is his code:

      Reference:

      http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_RTree_Sear...

      He also has a sophisticated way to define the bounding box at an angle that is often a lot more efficient than a dumb XYZ world coordinate box. Since Rhinocommon seems to lack a multi-object bounding box command except for points, it makes sense that he is populating curves with a few points to do it all via points. This makes it more complicated for me to adapt it directly to surfaces instead of pseudo-surfaces (via isocurve wireframe extraction) though, but I understand the script better now, so in time, perhaps.

      For my application at least, I successfully made his script twice as fast by ridding it of a complex math function of the metaball radius in favor of just using the radius itself:

      The script is also easier to understand now that I realize he early on assigns numbers to indicate object type, curve or point.

      24
    • up

      Nik Willmore

      Argh, crucial Geometry Pipeline is broken, causing any slow Grasshopper script to delay twice instead of once, as I now see that when I move a surface in Rhino manually, Pipeline is first re-invoking the old solution again before updating the new one!

      A test case of slow Populate Geometry with no VB script does the same damn thing, compared to bringing surfaces into Grasshopper via a normal Surface component (which won't add new surfaces from Rhino automatically):

      If I set the number of points from 700 to 1000 to about double the time, the initial delay and preview update to show the old solution again after the initial preview disappears, itself also doubles. I don't see two updates of the Profiler timer indication, only one, which is odd. A menu Recalculate does not have a doubled solution.

      Different Grasshopper preview settings or even no preview have little effect on this. I'll post a bug report, since, no, this is not good behavior at all.

      I need a script or an alternative to Geometry Pipeline for now, that will live update addition of new surfaces to the Rhino document without such a dual solution wave.

      5