Is there a preferred method of removing portions of terrain?

Objective:
I wish to design a 3D game that allows players to place modular objects for building purposes. The placed objects will always be upright, and may occasionally clip through terrain to remain upright.

Question:
Is there a performance friendly way to allow the placed object to delete/mask the intersecting terrain in run time, by the player?

I was contemplating 3 potential approaches, but alternatives are welcome:

  • Use some form of boolean subtract,
    but this could be costly during run
    time, and might not function well
    with complex geometry like terrain.
  • Design a voxel based terrain, where
    it deletes an area of voxels in a
    specified direction of the placed
    object.
  • Find a way to mask the undesired
    portion of terrain and it’s attached
    physics.

I’ve attached an image of what I am trying to accomplish. Any suggestions on ways to possibly accomplish this scenario are greatly appreciated.

Here is the progress of my research so far:

Voxel terrain (using the asset “Voxeland” as my point of reference):

Pros:

  1. Capable of high detail/realistic textures
  2. Allows easy creation of tunnels in terrain
  3. Supports decent water shaders
  4. Supports near limitless terrain sizes
  5. Can be edited by the player during run time, with manageable performance

Cons:

  1. Limitation on the maximum amount of textures. With texture arrays enabled, the number of possible block types (texture channels) is limited to 24 for all platforms that support texture arrays. When disabled, the maximum number of block types is limited to 4-16 depending on the build platform.

Edit height map data with TerrainData.SetHeights:

Pros:

  1. Near limitless amount of textures can be used
  2. Easily customizable terrain deforming brushes and falloffs can be used to edit terrain by the player in run time
  3. CPU strain can be eased if using tessellation with GPU
  4. Works well with many mesh editors and shaders

Cons:

  1. Doesn’t allow tunnels through terrain due to 0-1 black/white height map (A work around for tunnels, is a time consuming process of manually creating a new object to shape as the tunnel with the exit point matching the exact exterior of the intersecting terrain)
  2. May run into performance issues if running multiplayer, or too much terrain being edited (performance can be improved by using TerrainData.SetHeightsDelayLOD instead, followed by Terrain.ApplyDelayedHeightmapModification)
  3. Unable to undo terrain changes, as they override the height map
  4. Texture quality might suffer in and around terrain changes, if not using tesselation

Contrary to the high pros and low cons, the limitation on the amount textures for voxel terrain makes me lean towards editing the heightmap as my preffered method so far.

I will be looking into masking options next, to see if masking is a viable solution to my goal. With the little research I did on boolean subtracting meshes, it seemed far too unstable for complex meshes, for me to consider looking into that option further.

If anyone has any input on my current provided research, or any alternate solutions that I haven’t considered yet, please advise.


Here are some of the sources of my current research, for any interested:

  1. Voxeland asset:
    Voxeland | Terrain | Unity Asset Store
  2. TerrainData.SetHeights:
    Unity - Scripting API: TerrainData.SetHeights
    3. Tesselation:

Tessellation

Deformable Surface | Particles/Effects | Unity Asset Store