1
$\begingroup$

I'm working on a tree that needs to have a vertex color gradient depending on how far each vertex is along the branches of the tree, normalized in a 0-1 range.

To do this I'm trying to get the length of the longest spline with geometry nodes. I'm using shortest edge paths node to generate a tree structure, and trying to find what spline among the ones generated that is the longest.

How would I go about doing this in geometry nodes?

$\endgroup$
1
  • 1
    $\begingroup$ Have you tried a Spline Length node connected to a *Attribute Statistic node? The Max output is the length of the longest spline. $\endgroup$
    – Blunder
    Oct 31, 2023 at 14:41

1 Answer 1

2
$\begingroup$

You can use Spline Length node with Attribute Statistic node and its Max output value to get the maximum length amongst the splines.

To isolate the length and index of the Spline and populate with it Attribute fields you have to perform a length comparison and then multiply the result by the respective index. I have also included a Spline separation in case you need it:

enter image description here

Here is the Max Length Spline Group Node set up:

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you! Your solution works great. $\endgroup$
    – Adkopras
    Nov 1, 2023 at 11:00
  • $\begingroup$ @Adkopras You're welcome! $\endgroup$ Nov 1, 2023 at 12:57

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