4
$\begingroup$

I’m trying to perform a specific operation in Blender 4.2 using Geometry Nodes. My goal is to apply a Convex Hull around each consecutive pair of objects in a collection, combining them two at a time in sequence.

What I Want to Achieve: Normally, it’s simple to apply a Convex Hull to each individual object in a collection. However, I want to take it a step further by pairing each object in the collection with the next one in order (sorted by name) and applying a Convex Hull around each pair.

I’ve already written a Python script that does this, but I’d like to recreate it in Geometry Nodes. Here’s the logic I used in the Python script:

BLender Python Convex Hull script

In the script, I go through each object in the collection, pair them up sequentially, and apply a Convex Hull to each pair.

The Challenge in Geometry Nodes: In Geometry Nodes, I need help setting up the nodes to:

  1. Sequentially pair each object in the collection (already Realized as instances).
  2. Apply a Convex Hull to each resulting pair.

What I’ve Tried So Far:

  1. Here is my current Geometry Nodes setup. Geometry Nodes
  2. Here is my current Scene. Target Collection
  3. The result I would like to achive in geometry nodes . The result I want will be like this in geometry nodes

I’m using a Repeat Zone to handle the pairing, because the collection has more than two objects. Since I only want to combine two objects at a time, I set the Repeat iterations to be the number of objects in the collection minus one (e.g., for 8 objects, I use 7 iterations to get 7 Convex Hulls).

In this setup, I’ve created counters that increment with each iteration. I’m setting the indices “First Index” and “Second Index” to 0 and 1 at the start, and incrementing them by 1 with each repeat. Right now, this allows me to manually pair the first and last objects in the sequence.

However, I can’t get this to work automatically. After the Convex Hull operation on the 0th and 1st meshes, I want it to automatically proceed to the 1st and 2nd meshes in the next iteration, and so on.

Right now, I can only manage this pairing manually, but I’m looking for a way to automate it in Geometry Nodes. Any advice would be greatly appreciated!

$\endgroup$
2
  • $\begingroup$ So the final result you want is n-1 convex hull meshes, with overlap between adjacent hulls ? I'm not sure what is the issue exactly but I haven't opened your blend yet. $\endgroup$
    – Lutzi
    Commented Nov 12 at 17:40
  • $\begingroup$ Yeah, Exactly what ı want $\endgroup$
    – HtoiVinci
    Commented Nov 12 at 17:44

2 Answers 2

5
$\begingroup$

You were on the right track to achieve that. I'm not sure exactly why your setup doesn't work. Here are the nodes I came up with :

enter image description here

enter image description here

The steps are as follows :

  1. The number of iterations is the number of objects in the collection -1
  2. Add a single Iteration Index integer field to the Repeat Zone. We add 1 to it at the end of the loop.
  3. Separate the current object (index=iteration index) and the next object (index=iteration index+1, which is equivalent to index-1 = iteration index)
  4. Realize the two selected objects and add the Convex Hull node
  5. Enjoy the rest of your day

Here is the blend file :

$\endgroup$
1
  • 1
    $\begingroup$ Thank you so much. Your response was incredibly helpful for a Geometry Nodes newbie like myself. I really appreciate you taking the time. $\endgroup$
    – HtoiVinci
    Commented Nov 12 at 18:33
4
$\begingroup$

You could also, without a repeat zone, just group the geometry into pairs:

$\endgroup$
1
  • $\begingroup$ Thank you so much ı can clearly understand now how GN works, Ihonestly appreciate you taking the time $\endgroup$
    – HtoiVinci
    Commented Nov 14 at 9:46

You must log in to answer this question.

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