5
$\begingroup$

I am trying to make (simplified example) the following:

  • A curve
  • with icospheres along its length
  • where the radius and distance between icospheres is proportional to the distance from the start-point of the curve

What I'd like:

target goal

I understand that the Curve Parameter node is responsible for telling me how far along a curve I am, on the interval [0-1]. So my intuition is to pipe the curve param into both the scale of the instances, as well as the length offset of the Resample Curve node:

enter image description here

!IMPORTANT! If you emulate my tree, make sure you have an Add node between Curve Parameter and Resample, or you'll get a huge number of icospheres and things will get slow :)

But this does not appear to work: Not only is the distance offset between spheres the same; they also are not scaled at all! (I've already confirmed that this is not due to imperceptibly small differences in scale)

Am I misunderstanding the Curve Parameter node? Is there another way I could better accomplish this?

enter image description here

$\endgroup$
8
  • 1
    $\begingroup$ I've modified your scale so that the change in scale can be seen, and if I leave out the input to the resample length, I get scaled icospheres, but they remain evenly spaced. I don't think it's the Curve parameter that's giving you a problem but the way you're trying to use it to get unequal spacing in the resample. $\endgroup$ Commented Jan 23, 2022 at 0:55
  • $\begingroup$ Ah, indeed you're right; when I plug scale into Instances instead of the Scale node, things seem to work better, like you say: i.sstatic.net/LfuMG.png. I wonder if that's what "Realized data" means in the info header, "Realized data in input geometry is ignored" $\endgroup$
    – j6m8
    Commented Jan 23, 2022 at 0:58
  • $\begingroup$ does this help at all? It's not the answer because it's about curves as instances, but maybe the resample discussion is useful $\endgroup$ Commented Jan 23, 2022 at 1:10
  • $\begingroup$ Interesting. It doesn't look like the solution there is working for me, but this gives me something to chew on! Thank you! $\endgroup$
    – j6m8
    Commented Jan 23, 2022 at 1:14
  • 1
    $\begingroup$ @j6m8 it says that data is ignored because it is not instances. You need to scale instances after they are created in Instance on points. $\endgroup$
    – Crantisz
    Commented Jan 23, 2022 at 13:28

3 Answers 3

2
$\begingroup$

This solution is 100% accurate only for a straight line. Dealing with bezier lengths is very tricky and requires recursion, so really for a 100% accurate result on a curve I would expect only a Python solution to work...

Let's say each next icosphere is twice bigger. Let's manually calculate icos. positions.

If you have a single icosphere, you want to position it in the middle of the curve, 50% of it's length, or 1/2.

If you have two icos., you want the first to take 1/3, and the other to take 2/3 of the curve. So you want to position them at ${1\over3} \times {1\over2} = {1\over6}$ and ${1\over3} + {2\over3} \times {1\over2} = {2\over3}$. Multiplying by half, because the center is in half of the taken space.

3 icospheres positions:

  • ${1\over7} \times {1\over2} = {1\over14}$
  • ${1\over7} + {2\over7} \times {1\over2} = {2\over7}$
  • ${1\over7} + {2\over7} + {4\over7} \times {1\over2} = {3\over7} + {2\over7} = {5\over7}$

4 icospheres positions:

  • ${1\over15} \times {1\over2} = {1\over30}$
  • ${1\over15} + {2\over15} \times {1\over2} = {2\over15}$
  • ${1\over15} + {2\over15} + {4\over15} \times {1\over2} = {3\over15} + {2\over15} = {5\over15}$
  • ${1\over15} + {2\over15} + {4\over15} + {8\over15} \times {1\over2} = {7\over15} + {4\over15} = {11\over15}$

You probably see a pattern by now:

  • Space taken by each instance is a fraction with the numerator being the index raised to the power of 2...
  1. $0^2 = 1$
  2. $1^2 = 2$
  3. $2^2 = 4$
  4. $3^2 = 8$
  • ...And the denominator being the total number of icos. raised to the power of 2, minus 1.
  1. Icos.: $1/1$
  2. Icos.: $1/3$, $2/3$
  3. Icos.: $1/7$, $2/7$, $4/7$
  4. Icos.: $1/15$, $2/15$, $4/15$, $8/15$
  • Finally, the offset caused by previous instances follows the same pattern: 0, 1, 3, 7...

All those things can be calculated for each instance independently, without some iteration or recursion that geometry nodes don't yet support. The formula becomes:

$f = {2^{i-1}\over d} + {{2^i\over2}\over d} = {2^{i-1} + {2^i\div2}\over d}$

$d = 2^n -1$

where $f$ is a factor (% of the curve to sample a position at), $n$ is the number of icospheres and $i$ is the index of the icosphere.

$\endgroup$
2
  • $\begingroup$ While the geonode modifier has Base as one of the inputs, the node setup isn't quite ready to deal with changed base... $\endgroup$ Commented Jan 23, 2022 at 21:22
  • $\begingroup$ Wow, this is some really clever work!! It looks to me like it closely matches a non-straight bezier closely enough for my purposes; thank you!! $\endgroup$
    – j6m8
    Commented Jan 24, 2022 at 13:18
3
$\begingroup$

The Scale Instances node operates on instances, not geometry, so it cannot be used before the Instance on Points node. There are two ways to scale instances:

Scaling with the Instance on Points node:

This is the simplest way to scale instances. Just plug the scale directly into the Instance on Points node, as shown in this image. enter image description here Note that the Combine XYZ node is unnecessary, since this is how Blender converts floats to vectors anyway.

Scaling with the Scale Instances node:

Using the Scale Instances node with the curve factor is slightly more difficult. Since the Instance on Points node does not transfer this data to instances, you need to use a Capture Attribute node before the Instance on Points node. Then you can place a Scale Instances node after the Instance on Points node, and use the captured attribute. enter image description here

$\endgroup$
1
  • $\begingroup$ This is great, thank you! It looks like the icospheres are still uniformly distributed along the curve; does that follow a similar solution on the Resample Curve node? $\endgroup$
    – j6m8
    Commented Jan 23, 2022 at 13:33
2
$\begingroup$

You can scale after Instances on Points but if you use a field for the Scale input, you can also scale in Instances on Points. This tree:

node tree to scale instances on points

produces this output:

scaled instances

if the original curve is an unmodified Bezier circle.

The remaining problem, and it has me stumped, is to scale the distance between the instances. This tree

tree that almost works

does scale the length, as you can see by changing the constant in the Multiply node; but it scales the lengths evenly and it should scale by distance of the control point along the original curve.

$\endgroup$
4
  • 1
    $\begingroup$ Nice! I adapted your tree to get this: i.sstatic.net/1Bw9e.png I'm cheating by instancing a TON of spheres, and then choosing them using a scaled cyclical function (here, a Sine wave scaled by a log). It's still very clunky, because I get multiple spheres within a very tight distance of each other, but they at least overlap almost perfectly... $\endgroup$
    – j6m8
    Commented Jan 23, 2022 at 16:16
  • 1
    $\begingroup$ Here's the output of the tree I posted. Very brittle, and has a lot of overlapping geometry... i.sstatic.net/tV6Fi.png $\endgroup$
    – j6m8
    Commented Jan 23, 2022 at 16:17
  • $\begingroup$ You might want to try the delete geometry node to get rid of the overlaps? $\endgroup$ Commented Jan 23, 2022 at 16:18
  • 1
    $\begingroup$ Aha! I don't have an implementation yet, although this is a good start, but the map range/multiply that drive the length have to be replaced by a Fibonacci sequence generator $\endgroup$ Commented Jan 23, 2022 at 16:31

You must log in to answer this question.

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