Search code examples
iosswiftscenekituibezierpatharkit

Can I union multiple transparent SCNShape objects?


I'm adding multiple transparent SCNShape objects to an ARSCNSceneView scene.

  • These shapes are based on user input and should overlap.
  • They are all flat shapes made with UIBezierPath on the same plane
  • Shapes has to be transparent, so the user can see the camera input behind

The problem is that overlapping shapes are very visible, and I'd like it to show as a single shape - the union of all shapes.

Failed approaches:

  • Putting it under same node and use parent opacity.
  • Merging the UIBezier paths.
  • Blend modes
  • Transparency modes
  • Drawing using primitive triangles instead of UIBezierPath

Wanted vs current results


Solution

  • You could have a look at VectorBoolean which is a swift library to deal with boolean operations like the union you are looking for. I haven't tried it myself but have heard some good things about it.