0
$\begingroup$

The Geometry Node method is considered one of the best methods to generate complex geometries in a short time, because I have already requested a job that consists of generating spheres with a random distribution without overlap inside a cube, so one of the members created his own Geometry Nodes, which can be found at this link: Random spheres inside a cube

I hope the owner of this design (Hulifier) or someone else will explain the main points of this node and the algorithm I used in Poisson-disc Algorithm to us because I need it for scientific research.

Geometry node of generation: enter image description here

$\endgroup$
0

1 Answer 1

2
$\begingroup$

The idea is to use the node Distribute Points on Faces to generate points in a cube volume, the reason for using this node is that it has an option for minimum distance when in Poisson-disk mode (I believe it does that by generating the points and then deleting the invalid ones), which we can use to keep spheres from intersecting.

Since the node Distribute Points on Faces only distributes on faces, we can simulate a volume with many layers of planes inside the volume. With a bigger layer count, more possible positions are available to points, and thus points tend to be more closer to each other, but always obeying the minimum distance.

to eliminate the need to check and delete spheres intersecting with the bounding cube, the layers can be created with edges far from the cube bounds by the desired radius, that way spheres will at most touch the bounding cube.

node tree

Detailed Steps

First a vertical line is created centered to the bounding cube, it's length is $w - 2r$, where $w$ is the bounding cube's size, and $r$ is the desired radius for the spheres.

generated line

Then, planes with dimensions equal to $w - r$ are instanced equally spaced along the line. Spheres generated on them will be more closer to each other as the number of planes increase.

instanced planes

On the generated planes, points are distributed with a minimum distance of $2r$. (points of all planes are considered when generating them, so the minimum distance also applies between points of different layers).

After that just instance spheres with radius $r$ on the distributed points;

I also check if a sphere of the desired radius can fit in the bounding cube before outputting the geometry, since a single sphere is still created by this method when the radius value meet that condition.

single sphere bigger than bounds is generated by the node tree node tree that outputs no geometry when radius is too big for fitting in the cube

$\endgroup$
4
  • $\begingroup$ Stupid question: Why don't you add this additional information to the original post? This question here is actually superfluous, if an explanation of your solution actually belongs to another answer. $\endgroup$
    – quellenform
    Aug 24, 2023 at 23:03
  • $\begingroup$ @quellenform done, it's also there now. $\endgroup$
    – Hulifier
    Aug 24, 2023 at 23:07
  • $\begingroup$ Perfect! Thanks for helping to keep this platform tidy! $\endgroup$
    – quellenform
    Aug 24, 2023 at 23:18
  • $\begingroup$ Thanks Hulifier for the interesting explanation, Regarding the bar of Radius, Quality and Density Max, is there a mathematical relationship between them? I want to plot also the Radial Distribution Function for Hard Spheres curve g(r). $\endgroup$
    – saded
    Aug 25, 2023 at 19:28

Not the answer you're looking for? Browse other questions tagged .