I’m trying to make a tree using geometry nodes. I want to align my branches to the curve tangent, so that the branches point away from the bends in the trunk. I’ve got this far, but now I want to add a control to angle the branches up or down.
I think the issue is that although the Z axis of the branch is aligned to the curve tangent, the X and Y are aligned arbitrarily. Is there a way to align a second axis to be pointing away from the curve, so that I can then rotate the branch about the third?
I would recommend not using a tangent as the vector starting out, since it can make predicting the direction of the branches difficult due to all the weird directions they can take growing from all the little nooks and crannies on your curve.
The way I’ve done it is to have two rotations in play. The first for spinning the branches around the curve, and the 2nd for their upward/downward pitch. Like so…
Thanks! I may well end up just doing random rotations around the trunk if I can’t figure this out, as you say it makes the axis alignment of the branches completely predictable and therefore easier to manage. What I’m really trying to do though is make the branches grow away from the direction of the bends in the trunk. I don’t know if you’ve used SpeedTree but the term they use that I’m trying to emulate is “bifurcation”…
You’d need to find a way to limit the range of rotation on your branches, so that the tangent never causes a branch to rotate in a negative direction. In practice though, it’s easier just to boil things down to their most general settings, as in you have these branches spawning off these points, and these branches lean in X direction.
I’ve been toying with trees in geonodes on and off for about two years now, and I’ve always tried to find a balance between realism, and ease of control. If you wanna see what I’ve done thus far, you can download my attempts, and take them apart.
Thanks, looks like there is a lot for me to read there!
I was wondering earlier if it made sense to have individual elements as separate objects in the scene, sounds like that route is going to be worth exploring.
I wouldn’t separate each part entirely, but it does make things a lot easier to deal with, and gives you more flexibility if you give each stage of branch growth its own node. I originally had my trees driven by one big node, and it was slow, limited, and a massive pain to tweak.
Since I’m in that fortunate position between jobs where I don’t have to actually get things done at the moment, I’ve been thinking about this again today.
My idea was that if I could get the position of the each point on the curve and calculate the vector between that and the point before and after it (by subtracting the start point position from the end point position), averaging between them would give me a vector that I could negate to point away from the direction of the curve.
The problem is, it only seems to work on the x and y axis, and the z axis is remaining at 0? I think that the Align Euler to Vector node is potentially the issue here, is there something I should be using instead to properly align each instance to the vector (assuming I’ve even calculated it correctly!).
Please bear in mind that I’m brand new to Blender (my next job is going to require me to use it so I’m supposed to be getting generally comfortable with it and probably shouldn’t be down a random rabbit hole already), and am not much of a mathematician, so I am basically just winging it here!
The one reason why I always shied away from using the tangent is because branches rarely ever grown downwards on real trees. Even if they start that way, they’ll eventually start trying to sweep back upwards. Having one that’s growing downward too much can be difficult to steer back in the right direction, and ends up looking goofy and sloppy in the process.
Your results look great, but it still has a couple of branches shooting downwards that’d cause me some concern.
Completely agree and one of the next features of SpeedTree I would like to think about is gravity, so that I can select the ends of the branches and bend them up or downwards.
Another possibility I’d like to think about is only selecting the branches where the curve angle is greater than a certain threshold, to remove the branches on the straighter bits of trunk.
Willows aren’t actually trees, so they don’t count.
Off the top of my head (I don’t wanna think too much, because I’m working on my own math bullcrap at the moment), it could probably be done with a combination of a tangent, a compare node, and a delete geometry node.