1
$\begingroup$

I am trying to make a tree generator in geometry nodes. There is a bezier curve defining the root, and I would like to recursively define smaller stems extending from the root.

This is how the stem is defined: stem geometry nodes

I would like to pass the current radius from the root to use it as "starting width" on the stem so that the width of the stems extending from the top of the tree would be thinner. See how the "tree" looks like without it:

tree

I tried connecting Radius node to the "starting width" directly, but then the radius is taken from the smaller stem geometry, and not the root geometry. I also tried capture/transfer attributes, but haven't managed to make them work. I managed to eye-ball the size and pass it through "scale", but I don't like this solution.

  1. How do I capture the radius of the curve to be able to pass it as an input to another subgeometry?
  2. I also have a problem with the smaller stems being generated from the same seed even though I pass a random value. How do I pass a different seed per instance?

tree geometry nodes

$\endgroup$

2 Answers 2

3
$\begingroup$

The main problem with your setup is, that you try to change the object, that shall be instantiated. The Instance on Points node will normally generate multiple instances of exactly one identical object. You cannot change the object before instantiation. Instead, you may scale, rotate or translate the instances afterwards or you may realize the instances and modify the resulting geometry.

You have the option to provide a collection of elements, so that the Instance on Points node will choose one of these instances for every instantiation by choosing Pick Instance. But the principle is the same here: If you instantiate one element of this collection multiple times, every of these instances will be the instance of exactly the same object. And you may change it afterwards following the same rules as mentioned above.

Following you will find a solution to your questions. I won’t describe everything in detail, because many of the concepts, that I used, are explained in this video from Erindale. Instead, I will focus on your two questions.

This is the complete solution:

node net

Here you find an overview, that I will explain below:

overview

At (1) the lines for the trunks are generated. They are scaled randomly in length on instantiation. Next the instances are realized, so that they can be modified in (2). Every trunk gets modified individually. This gives me the opportunity to capture the radius, when setting it.

Creating the branches works correspondingly. In (3) the lines for the branches are created. Next the instances are realized and in (4) they are modified individually.

Coming back to your questions:

  1. Capturing the radius is shown in my example. But this would not work, if you tried to apply it to the object, that should be instantiated. You have to use it on the realized instances.
  2. You can only use different seeds after realizing the instances and not on the object, that should be instantiated, because it is only one object, that can only have one seed.

And here you can see the result:

result

$\endgroup$
1
  • 1
    $\begingroup$ wow, thanks for the detailed explanation! $\endgroup$
    – sygi
    Apr 23, 2022 at 18:32
1
$\begingroup$

I don't exactly know what you mean with your second question.

For one:

In your stem group after you set the curve radius, capture the radius attribute with a "Capture Attribute" node. Connect the captured radius attribute to the group output.

capture radius of trunk/stem

We need to instance a curve not a mesh, since we set curve profile later. instance curve not mesh

Then set the curve radius from the stems to the radius from the trunk. With a "Endpoint selection" node we select the first 17 segments. Same number as the "Quadratic Bezier"-Node resolution, otherwise you get strange results. set stem radius from captured trunk radius

Final result. final result

$\endgroup$

You must log in to answer this question.

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