2
$\begingroup$

As a proof of concept (and to familiarize myself with Geometry Nodes), I am trying to make a (semi-)procedural date palm tree with Blender 3.3. I use one Bézier Curve with a Geometry Node setup to create the trunk. Within the trunk Geometry Node setup, I add instances of branches (multiple Bézier Curves in a collection) and populate the branches with leaves (multiple Meshes in a collection). Currently, I have troubles to rotate the leaf instances properly.

I found an answer to a similar question here, which does not work for my case due to the facts highlighted in bold in the introduction paragraph above.

Until now, I tried the following two approaches (the results of which are shown below):

  1. Converting my branch Bézier Curve via the Curve to Mesh geometry node to a Mesh and than create the instance points via Distribute Points on Faces geometry node. This led to a very organic leaf distribution, but the rotation (even using the Normal information) was all over the place and did not behave predictably/controllable.
  2. Directly instancing the leaves on the curve. This resulted in a more predictable rotation behavior, but looked artificial and the rotation was still not correct.

Comparison of the status quo

Issues

The following issues occur:

Issue 1

No matter how I try to rotate the leaves, the end of the branches do not look not correct (red circles in image above). As the rotation/length of leaves of palm trees change of the length of the branch, I would need a way to adjust the rotation/scale of the instances in relation to the relative position on the branch.

Issue 2

The z-direction of the leaves is aligned with the global z-direction in most of the cases (setting it to relative/local did change nothing). I would like to recreate the natural case, where the leaf orientation would follow more the branch orientation.

Questions

  1. What would be a solution to adjust the rotation/scale of the instances in relation to the relative position on a Bézier Curve?
  2. Is my approach of creating all the instances within the geometry node setup of the trunk unfavorable? If so, what is a better approach?

Geometry Node Setup

Important: The Geometry Node Setup for Approach 1 (Curve -> Mesh -> Distribute Points on Faces) is described.

Screenshot of the Geometry Nodes Workspace: Procedural Palm Tree Workspace Screenshot All the assets which should be instanced are placed in a dedicated collection (Bézier Curves as well as Meshes). The Geometry Node Setup will be applied on the Bézier Curve PalmTreeGenerator.

For reference, the current PalmTreeGenerator Geometry Node Setup looks like this: Main Trunk Geometry Node Setup Relevant for the problem are the following Groups: TopBulge (Emitter of Branches), Branches (Instancing of Branches on Emitter) and Leaves (Instancing of Leaves on Branch Instance).

The TopBulge Group loads an Icosphere from a Collection. To adjust its orientation to the trunk, I had to add an extra rotation. However, removing/changing the rotation has no effect on the overall problem; it still occurs. Top Bulge Geometry Node Setup (Branch Emitter)

The Branches Group picks one random instance of the Bézier Curves in the Collection. In order that the branches are not instanced in one spot, I need to use the z-rotation returned by the Distribute Points on Faces Geometry Node. If I would use all rotations, the branches would be skewed. The two Euler Rotate Geometry Nodes are remnants of my experiments to align the rotation to normals. For this post, I reset all the parameters to zero (problem becomes easier to see). All the Geometry Nodes on the right-hand side are used to convert the Bézier Curve into a mesh. It is done twice to have more control over the mesh (especially starting point of leaves and number of faces) used for the leaf instancing. Branches Geometry Node Setup

The Leaves Group instances the leaves on the branches. It is done twice (left/right side of branch). Here I manually set a rotation that looked best. Trying here to work with Normal information via Align Euler to Vector made the end result worse. Leaves Geometry Node Setup

The blend file is available at my OpenGameart page under CC-BY-4.0.

$\endgroup$
4
  • 1
    $\begingroup$ Without knowing the complete node tree, it is difficult to give an answer here. There are simply too many possibilities where something can go wrong. Please complete the question with more pictures or upload your blend file here: blend-exchange.com $\endgroup$
    – quellenform
    Oct 24, 2022 at 14:55
  • $\begingroup$ Thanks for all the pictures! This helps at least partially, but I have too little time at the moment to study it all. Easier/faster would be as said if you share your blend file. Maybe this answer will help you a step further: blender.stackexchange.com/questions/273599 $\endgroup$
    – quellenform
    Oct 24, 2022 at 16:24
  • $\begingroup$ ...or maybe this one: blender.stackexchange.com/questions/273883 (more simplified version). $\endgroup$
    – quellenform
    Oct 24, 2022 at 16:25
  • $\begingroup$ @quellenform Thank you very much for your suggestion. Wow, never had somebody comment whilst I was still editing the post and adding the screenshots :-) Hopefully, my edit clarifies the details of how the Geometry Nodes are setup. Blend file is now also available via my opengameart page: ttps://opengameart.org/content/procedural-date-palm-tree $\endgroup$
    – dsacre
    Oct 24, 2022 at 16:38

1 Answer 1

2
$\begingroup$

In order to correctly position the objects subsequently instantiated on a mesh and to get the desired rotation/scaling, you need the data of the original curve, which you use in combination with Mesh to Curve to create the geometry.

You need two things here:

  • The tangents of the curve, because you want to know in which direction the leaves should be rotated.
  • The factor of the curve, because you want to scale the leaves smaller towards the end.

This is done in the group "Branches" before creating the mesh:

enter image description here

Here I store the two required values with Store Named Attribute, which are preserved in the geometry and can be used later.

The next step happens in the group where you instantiate the leaves.

The way you do this depends on what exactly you want to achieve.

I have built an example for you here. Of course it could be done differently (or easier), but I think this example gives you a good start:

enter image description here

Here I first create a Rotation with the previously saved tangent, so that the leaves are correctly aligned along the mesh.

The second rotation aligns the leaves so that they point in opposite directions.

Next, I use the previously saved value of the curve factor to create a smooth transition in combination with Float Curve.

One serves as an additional rotation to rotate the leaves more towards the end, and the other value serves as a scale to make the leaves smaller towards the end.

Depending on how you do all this exactly and which values you modify, the result could look something like this:

enter image description here


(Blender 3.3+)

$\endgroup$
2
  • $\begingroup$ Thank you very much of your efforts. This is indeed a great starting point. Store Named Attribute was missing in my previous attempts. Before this post, I had not separated the Geometry Nodes into Groups, which led to funny results when using Spline Parameter without Store Named Attribute (due to the amount of Bézier Curves in the scene). $\endgroup$
    – dsacre
    Oct 25, 2022 at 10:00
  • $\begingroup$ Marked it as "Accepted Answer" just now, after I had time for a thorough analysis of your Geometry Node Setup. After re-constructing your answer, I am wondering while applying a scale to the leaves requires to change the leaf rotation from twice x axis (180° and -180°) to once x axis (180°) and once y axis (180°). It does not affect the status of the question, just out of curiosity :-). Is this an implementation detail in Blender? Because mathematically, if you scale all dimensions equally, the angles should stay identical, therefor no additional (axis) rotation can ever occur. $\endgroup$
    – dsacre
    Oct 25, 2022 at 13:22

You must log in to answer this question.

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