3
$\begingroup$

I have this grid of dots I created using Geometry nodes:

enter image description here

enter image description here

(To explain the random positioning, I added a texture of some perlin noise, and then used the displace modifier on the X and Y coordinates).

I would like each sphere to connect to 0-N number of randomly chosen spheres/instances with a line (very thin cylinder where it's possible to set a custom material for it).

With the ability to modify a random seed of what spheres connect to what other spheres so that I can see how different connections look.

Like so:

enter image description here

Preferably with a parameter for the randomly chosen number of connections for each sphere. (So one sphere gets 3 connections to randomly chosen spheres, another gets 8 connections to randomly chosen spheres, and so on), and I can change that so it's a maximum random value of 100 connections and a minimum random value of 30 connections, and so on.

How can I do this with Geometry nodes?

$\endgroup$

1 Answer 1

2
$\begingroup$

All you have to do is randomly generate integer values between $0$ and the number of your points (minus $1$), and use the Field at Index node (available since Blender 3.1) to capture the corresponding positions of the points.

By then instantiating lines on those points, and moving the last point of each to your previously captured position, you should essentially get the desired result:

enter image description here enter image description here

The example here does just that, but both the creation of the points and the connection of the points are done entirely by chance.

To set the number of connections per point also randomly, you can additionally duplicate the created points with a random value:

enter image description here

In this example you can even display the connection as a curve and adjust the curve as you like, if you add this group:

enter image description here

The trick here is that I convert the lines into Bézier curves and influence/move their curve handles with a few parameters.

enter image description here


And here is the entire node group, as well as the blend file:

enter image description here


(Blender 3.6+)

$\endgroup$
1
  • $\begingroup$ I can't thank you enough for such a beautiful and comprehensive answer! $\endgroup$
    – Hmm
    Commented Apr 12, 2022 at 4:19

You must log in to answer this question.

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