0
$\begingroup$

I have a tree hierarchy "trunk > branch > twig". Each branch is a curve instance on trunk, each twig is a curve instance on branch. The whole thing is created with geometry nodes following this scheme (simplified):

example

on the left primary curve ("trunk") with 3 secondary curves instanced on it ("branch") with each 4 tertiary curves instanced on it ("twig")

I would like to get a convex hull for each branch and its "attached" twigs. Is there a way to "group" one curve instance and the other curve instances "attached to it" for the convex hull to operate on? Right now I only succeed in getting the convex hull for the whole tree or for each curve instance.

example

here an example of what I'm trying to achieve

  • red: manually made branch+twigs convex hull example
  • green: branch (curve instance on trunk)
  • blue: twig (curve instance on branch)

Thanks to below answer by @Nathan, I could capture and store instance index, and select geometry where this value is equal to 1.

enter image description here

first "capture attribute" "index" on "instance
then store named attribute
finally separate geometry where the attribute is equal to "1"

The problem of this is that "separate geometry" produces two outputs (selection and inverted), while I would like to perform a convex hull on each of the groups.

$\endgroup$

1 Answer 1

1
$\begingroup$

Use collection membership to group the objects however you'd like. Instance that collection in geometry nodes and realize instances to do anything you want to it, including generating a convex hull:

enter image description here

In light of edits to your question:

If we want to organize instances inside of a geometry nodes modifier, we can capture the index of the instancing point, which the instances will inherit. After realizing instances, we can use that index as a sort of group for our instances. Here's an example, using what you're showing as a base:

enter image description here

I'm making a "trunk", capturing the index of the instancing point onto branches (and onto anything those branches instance.) I'm also capturing the index of the instancing point from the branches onto the twigs. Two separate attributes.

Later on, to reference these and create convex hulls, I can use these indices. In one arm, I'm making one convex hull of all branches and twigs with an index equal to 1. In another arm, I'm making a convex hull of all branches and twigs with an index equal to 2. In a third arm, I'm demonstrating how I can do this further down the line: I'm making a convex hull of a twig, with trunk index equal to 0 (indicating the branch) and branch index equal to 1. Math/multiply, operating on 1/0, true/false values, is the equivalent of a Boolean AND operation.

Rather than operating directly on the curves, I'm giving them some radius so that you can actually see the convex hull of the twig (otherwise, the convex hull of a line is no bigger than that line.)

$\endgroup$
6
  • $\begingroup$ It could work if I had multiple objects, but here I have curve1 + instance on points (curve2) + instance on points (curve2). So my tree is a single procedural object generated with geometry nodes. I'll update my question to make this more clear. $\endgroup$ Dec 19, 2023 at 23:34
  • $\begingroup$ @Hugo then realize instances on that object, assign attributes to specific pieces of it, and in your convex hull GN, separate geo by those attributes. Hard to tell you how best to do that without having your nodes, but that's the general plan. $\endgroup$
    – Nathan
    Dec 19, 2023 at 23:36
  • $\begingroup$ Ok thanks! So You suggest using for example the instance index, save it to an attribute, propagate it to "twigs" and then separate before applying convex hull. I'll try that (and I added more details on the nodes in the question). $\endgroup$ Dec 19, 2023 at 23:48
  • $\begingroup$ Yeah. Looking at your nodes, you've got three iterations, so you save the index of the iteration you want (convex hull of a branch etc, of a twig etc , of a leaf.) Note that there's no real geo in your nodes, just the curves, so it's of course not the convex hull of any geo. If you're having trouble, let me know-- I can edit the answer. $\endgroup$
    – Nathan
    Dec 19, 2023 at 23:51
  • $\begingroup$ I added a third screenshot with "separate geometry" and now I'm able to produce a convex hull to one of them, but not each of the groups. In can select the group in the "equal" node. $\endgroup$ Dec 20, 2023 at 0:22

You must log in to answer this question.

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