Carving into geometry using a Boolean with a spline?

I’m trying to create a procedural cave system using splines but I can’t seem to figure out how to carve into a mesh using them. I tried spawning a mesh repeatedly along the spline and using the geometry script plugin with a Boolean but I can’t figure out how to get it to work. Does anyone have any insight out how to perform a Boolean operation using a spline?

Here’s what I did, its limited - but it might help you get started.

It sounds like you have a Dynamic Mesh Actor setup already. So in that actor:

  1. Create a profile spline (I used Y/Z plane)
  2. Create a sweep polyline using the profile and your sweep spline (see how I use Y/Z when converting to points)
  3. Boolean your base mesh with that

I’m only doing this with one sweep spline, and my early tests with two caused some artifacting. But I’d be curious to know how you fare if this approach works for you.

It doesn’t seem to be working for me. Is it alright if I see your event graph and construction script just to make sure I’m doing this right? Apologies for my inexpertise, I don’t know much about geometry script.

I’m not using CS (I don’t think you need to for GS?), the boolean function just runs on the Event On Rebuild Generated Mesh - the only additional relevant code is an Append Box node that creates the base shape (BaseBoxMesh). So just imagine my last screenshot coming right after this.

*Ignore all the width/depth calculations, that’s just specific for my needs

I’m assuming you’re using this method to create the boolean? https://www.youtube.com/watch?v=K1U9mxHjX4Y

Thank you for clarifying.

Yes that is the method I use. It still doesn’t seem to work. I think It’s because I’m not actually providing the engine with a proper tool mesh (the dynamic spline mesh)

I’m assuming the “Allocate Compute Mesh” node is there to create the temporary mesh to use as a Boolean along the spline? How does the engine know what mesh shape to use along the spline?

Hmm, your code looks ok - how about your spline orientations? My sweep spline is X/Z and my profile is Y/Z.

Yes, the compute mesh is just a throwaway that contains the swept object (that’s what the append sweep polyline node is doing).

Try attaching the code that creates the swept object directly to the On Rebuild event without the boolean - you should see the swept mesh. To do this use the Targetmesh from the event as the container for your sweep (not the compute mesh), and disconnect the boolean.

I forgot you also want to add a ‘release all compute meshes’ node at the end, although it shouldn’t interfere with it working - its just good practice to clear the memory.


That worked, thanks for your help! I’ll be sure to post updates on this. Thanks for kicking this thing off.

1 Like

No sweat and please do post anything you discover!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.