Grasshopper

generative modeling for Rhino

# Metaball equation

hello,

I have been using the metaball component, and I have been looking for the ecuation used on it, I have found several ecuations for metaballs(I need the one with the threshold included), but wich one is the one used on the GH component?

Views: 2606

### Replies to This Discussion

I think it's marching cubes

Marching cubes is the algorithm used to trace the metaball isosurface (or isocurve as it's purely 2D at the moment).

The equation for the falloff is actually not hard-coded. The algorithm I wrote requires a delegate function to solve the potential at any given coordinate. I use a Sine wave falloff for the Search and Group outlines on the Grasshopper canvas, and an inverse square falloff in the Metaball components. Both of these are provided with the algorithm, but there's nothing stopping you from writing a custom one. Though note the algorithm has been optimized with the assumption that any falloff curve only ever has a negative derivative.

--

David Rutten

david@mcneel.com

Ok,

but the fact is that I want to do a network of bubbles connected. So I would like to know, how to use the threshold to have each bubble with a controlled size and control the conections.

Actually I have done it, using several point for each bubble, but I think that If I use a custom one, and change the threshold, maybe I can do what I want.

It's not the threshold that you need to control for each point but the charge. If you have 20 points you need to supply 20 charges.

Example below shows a series of numbers as the charges, and the circles represent the size of charge, smallest on left to largest on right.

PERFECT!!!

thank you so much, I was using the other component, I haven't thought about using the custom one.

Although I need to find the real ecuation used on this component, because I have to justify the form and how the threshold work.

Again thank you.

This is how a 2D metaball works.

1) You supply a bunch of points, and each point has an optional scaling factor (charge, if you will)

2) You sample the space around each point. The elevation you assign to every location in the space is the result of the fall-off equation. F/D² in the Metaball componenty, where D is the distance from the point to the location you're measuring and F is the scaling factor:

3) You repeat this for all the points, giving you a collection of revolved hyperbola:

4) Add the elevations for all hyperbolas together, just a simple A+B+C process:

5) You intersect this final landscape with a horizontal plane. The elevation of this plane corresponds with the iso-surface value. If we do it for a bunch of planes, you get the following result:

6) The interior of each slice represents the metaball, or rather the boundary of each slice:

That is the theory anyway, in order to actually get a speedy result the algorithm approaches the problem from a very different angle, but the result should be the same shape.

--

David Rutten

david@mcneel.com

thank you,

I have almost understood the proccess, now think I can almost control the sizes, and I can justify my form. Is it possible to upload this last definition just for seeing the way you have created the surface. Because I think that the way I'm usingi not the good one, I'm using meshfrompoints from rhino istead for marching cubes (I think this is the good way).

thank you for your help again.

Daniel, is possible to share  definition for esperiments ?
dear david,

once again a very interesting contribution.
these are pictures from one of your publications?
i would also like to see the gh definition. (:

thanks

I made the pictures for this post. They were done partly by hand and partly by Grasshopper, but posting the file would be useless (even if I saved it).

The commands I used:

_Hyperbola

_Revolve

_Copy

_Intersect

_Line

_Split

_Contour

_CutPlane

and in Grasshopper I made a grid of points, intersected the three surfaces with vertical lines starting from the grid, added the heights of the intersection points and created a new nurbs surface from those points.

--

David Rutten

david@mcneel.com

dear david,

thank you!

thank you!!!