3
$\begingroup$

I am struggling with making the following possible via Geometry Nodes:

  • Start with the input of a curve geometry, the number of points to distribute along the curve N, and e.g. radius R of an ICO sphere
  • Create an ICO sphere of radius R on one end of the curve
  • Generate N-1 more ICO spheres along the curve so that:
    • the last sphere is created at the other end of the curve
    • generated spheres are progressively scaled up/down (in a linear fashion, or optionally - following a Float Curve) and positioned so that they fill the curve completely while touching one another (or optionally, having a constant configurable gap/overlap)

This means that my objective is for the generated spheres to get bigger and bigger progressively if there are not enough of them to fill the curve if they would all have the input radius R, get smaller and smaller progressively if there are too many of them to fit into the curve. While spacing-wise, for them to behave as-if they were a series of beads being threaded onto the curve.

I tried my best to figure a solution out using the available learning materials but having found some that would recreate the scaling behaviour without the positioning aspect or vice versa, as a novice, I could not achieve a solution working as intended.

I attach a render and .blend file of my closest attempt that still misses the mark because:

  • Only a specific combinations of N and R would make the spheres touch
  • Increasing the number of points N prolongs the curve rather than squeezing the spheres

Any help will be appreciated!

Render of the failed attempt

$\endgroup$
2
  • $\begingroup$ Question: are the first and last spheres "centered" on the start and end points of the curve? Or are they like the threaded beads where the start point (the thread knot) is at the side of the sphere? $\endgroup$ Commented Oct 5 at 0:28
  • $\begingroup$ I feel like I've done this by accident a lot :-) $\endgroup$
    – Don Hatch
    Commented Oct 21 at 23:44

1 Answer 1

5
$\begingroup$

So, the answer for this involves some math.

Starting from:

$$length = Sum(diam\_i + gap)$$

Where $i$ is the index of the sphere, from $0$ to $count-1$, you can deduce things like:

$$length = (count-1)*gap + count*diam\_0 + (count-1)*count*diam\_step/2$$

Where $diam\_step$ the difference between diameters from sphere 2 to sphere 1 (which is equal for all consecutive spheres).
From this you calculate $diam\_step$ as a constant and use it in similar formulas for sphere position (in $length$) and $scale$

$$pos = (i+1/2)diam\_0 + i²diam\_step/2 + i*gap$$ $$scale = diam\_i/diam\_0 = 1 + i*diam\_incr/diam\_0$$

Create $count$ points with a Points node. Set their positions sampling $pos$ from the curve with length mode. And add instances on points, passing the scale.

I put the file with the solution in the answer, and I also added an error checker (if count is too big, scale goes below zero, in this case, I opted for not adding any sphere so you know there is an error)


File:


Geometry nodes initial portion:

Initial portion of geometry nodes


Final portion:

Final portion of geometry nodes


Diameter increment:


Position on curve:


Scale per index:

$\endgroup$
2
  • $\begingroup$ Thank you kindly, it did solve my problem and allowed me to proceed with what I hope ultimately to be a lovely printable file for miniature wargaming enjoyers! $\endgroup$
    – ryfterek
    Commented Oct 7 at 9:52
  • $\begingroup$ Thanks for your contribution, great content! Tip for the future: if you want to display mathematical formulas, read math.meta.stackexchange.com/questions/5020/… $\endgroup$
    – quellenform
    Commented Oct 30 at 19:15

You must log in to answer this question.

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