5
$\begingroup$

I'm working with a number of closed 2D curves within the same Bezier object and I've created a simple Geometry Nodes setup to preview them filled and extruded while keeping them editable at the same time. When the curves intersect the default behaviour is that the overlapping faces get deleted. Is there a way to change this to automatically perform a boolean union on all intersecting parts?

I've tried playing around with the mesh island and mesh boolean nodes but couldn't change the result.

Node setup and result

$\endgroup$
3
  • $\begingroup$ Good question. But I'm afraid that there is (currently) no simple solution to this problem. Would you be happy with a less simple answer? $\endgroup$
    – quellenform
    Commented Mar 16, 2023 at 0:10
  • $\begingroup$ Yes, good thing with GN is that once we've got the solution we can pack it into a node group and reuse it any time (hide the complex stuff and enjoy the result). I'm sure this is something I'd use in the future more. Also in my case I'm not using an impossibly big number of intersecting curves so I'd be interested in a "merging them one by one" solution too as a less beautiful solution. $\endgroup$
    – Booth
    Commented Mar 16, 2023 at 8:39
  • $\begingroup$ When a curve overlaps self like in case of letter "φ" converted to a curve, you can use a solution of mine here: How can I merge overlapping faces converted from a text string in a geometry node, to avoid Z-fighting issues during rendering? $\endgroup$ Commented Jul 13 at 8:04

2 Answers 2

12
$\begingroup$

There are several possibilities here, but since I don't know exactly what you want to do with the result, I suggest the following solution:

enter image description here

The first hurdle is that Fill Curve always creates holes when the curves are intersecting, but the splines cannot be completely converted to filled curves separately at the same location.

To work around this problem, first move all curves along the X or Y axis using the Spline Index so that they are far apart.

This allows you to apply Fill Curve to them without creating holes. You could also create Mesh Primitives in such a case, and move their points to the positions of the curve points, but that seemed more complicated to me.

Now that you have filled each curve completely, you can move them back to their original positions. With that, you've solved the first hurdle.

The second hurdle is that the faces still overlap, so you can't create a solid mesh.

To remove these areas, use the Mesh Boolean node and send a raycast to a duplicate of the object, which you scale by a factor of $0.9999$. This will detect the inside edges, which can then be removed. The remaining points should be merged with Merge by Distance to create a continuous mesh line.

Finally, you only have to convert this object into a curve and fill it again with Fill Curve. After that, this shape can be extruded into a solid object.

enter image description here


(Blender 3.4+)

$\endgroup$
5
  • $\begingroup$ wow, this sounds like a very clever solution - please allow me some time to examine and understand it in detail and I'll be definitely back, reacting to it. $\endgroup$
    – Booth
    Commented Mar 20, 2023 at 10:49
  • $\begingroup$ @Booth You're welcome! Take your time and if you have any questions, I'll be happy to help. $\endgroup$
    – quellenform
    Commented Mar 20, 2023 at 11:26
  • $\begingroup$ This works perfectly! I studied the node setup along with your description and I fully understand the concept. The technical part of removing excess edges was a bit harder as I don't have a solid knowledge of selection techniques. I was surprised in the first place that the mesh boolean node offers no easy way to remove excess.. The manual syis "Union: The two input meshes are joined, then any interior elements are removed" + there's also an intersecting edges output. I suppose these don't work because we're operating within the same object? $\endgroup$
    – Booth
    Commented Mar 22, 2023 at 10:22
  • $\begingroup$ @Booth Not exactly: The Intersecting Edges at Mesh Boolean select these edges, which are newly created by the boolean operation. But since in this case only new vertices are created at the intersecting edges of the curves, this does not work in this case. So it has more to do with the fact that this is a two-dimensional shape instead of a three-dimensional one. And since all shapes are on the same plane, Union does not remove any interior elements. $\endgroup$
    – quellenform
    Commented Mar 22, 2023 at 11:49
  • $\begingroup$ Ancient history now..but since this has come up a couple of times again recently, .. I'm getting away with Edge Neighbours > 1 deletion, followed by a refill, to avoid the Raycast .. i think. $\endgroup$
    – Robin Betts
    Commented Jun 11 at 17:42
2
$\begingroup$

enter image description here

Just adding to this, perhaps you want to separate the Curves before Fill, so it does not "Compound" so this might be simpler logic. But you do want "compound curve" that overlaps, so that's also something to consider.

However the BOOLEAN thing might be best.

$\endgroup$
1
  • $\begingroup$ Ah, that's a good idea! ..at the time I wrote the answer (3.4) the node Split to Instances didn't exist yet. $\endgroup$
    – quellenform
    Commented May 6 at 10:26

You must log in to answer this question.

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