3
$\begingroup$

I'm using Geometry Nodes to instance shapes in my scene and I'm trying to figure out if those instances overlap with another specific object. For the sake of simplicity, the specific object is a cube . If the instances do overlap, I'd like to delete the entire instance – not just the non-overlapping geometry (generated by the boolean operation).

My approach involves using a Mesh Boolean node and then testing if the point count is non-zero (using a Domain Size node). For this approach to work, I've had to realize instances. Here's what my node tree looks like:

enter image description here

Unfortunately, this doesn't work as expected. I'm guessing since I'm trying to delete the geometry that's generated further back in the chain, still stored as instance data. If I connect the output of the Mesh Boolean object, to Delete Geometry, I get the boolean difference but that leaves some artifacts that I don't want in the scene.

Blender Geometry Node graph

I know that you can use attributes to access data down the chain but is there anyway to send data from a realized mesh back to an instanced mesh?

Thanks for any tips/advice you can share!

$\endgroup$
2
  • $\begingroup$ I just realized the Boolean Mesh node should be set to "Intersect", not "Difference" (must have changed it along the way) but that still doesn't solve the issue. $\endgroup$
    – Mantissa
    Commented Aug 1, 2023 at 18:17
  • $\begingroup$ It looks like what's happening is that the patch deletes all of the instances or none of the instances (depending on whether or not any overlaps occur). $\endgroup$
    – Mantissa
    Commented Aug 1, 2023 at 18:23

1 Answer 1

4
$\begingroup$

If, as shown in your example, you are really only dealing with upright cubic shapes, then the node Raycast may help you.

With it you can check in this case, and without the computationally intensive process with Mesh Boolean, if another object crosses the path somewhere on the Z-axis.

Something like this:

enter image description here

Of course, you still need to use the Realize Instances node, since you need the individual points in this case. From each point you send a raycast up (or down). If there is a hit with another object, then you accumulate this value per mesh island and get a selection to delete the whole object.


(Blender 3.6+)

$\endgroup$
2
  • $\begingroup$ Thank you! I plan to use more complex shapes than cubes–but I do plan to use bounding boxes for testing, so this approach could work for me. Thanks for putting together a Blender file for me. I will definitely give this a try. $\endgroup$
    – Mantissa
    Commented Aug 2, 2023 at 18:39
  • $\begingroup$ I did manage to get this to work in Blender 3.6 using Simulation Nodes and baking. Instead of creating all of the instances at once, I added them 1 at a time in random positions and only added a shape to the scene if it did not overlap with a specific other shape. $\endgroup$
    – Mantissa
    Commented Aug 2, 2023 at 18:42

You must log in to answer this question.

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