• 3D
  • how to make a hole in terrain

I have a terrain mesh as the ground for my game.

I created a new cave mesh I want to add somewhere in my world (intersecting the terrain mesh).

I made both meshes in a modelling tool (e.g. Blender).

Want to do my world building (connecting the meshes) in Godot.

I'd like to achieve seamless connection between the meshes (e.g. Witcher style dungeon entrances as opposed to teleport entrances from Skyrim/Oblivion). And I'd like to do that in Godot rather than going back to Blender to modify my terrain.

Problem: How do I make a 'hole' in my terrain in Godot to allow access to the cave mesh?

I found a unity solution that uses an invisible object to depth buffer only + render priorities such that normal geometry (including the cave) is drawn, followed by the occluder, and then the terrain. Result: occluder appears to punch a see-through hole in the terrain.

Add to that some collision logic to pass through the terrain within the occluder box and you're good to go.

Unity solution described here: https://answers.unity.com/questions/316064/can-i-obscure-an-object-using-an-invisible-object.html

youtube demo here:

Can this be done in Godot? I can't find an equivalent for glColorMask to prevent the invisible opaque object from drawing color in its fragment shader.

Theres also: out float ALPHA_SCISSOR If written to, values below a certain amount of alpha are discarded. to try out, and if that doesn't work either then you could just try to use shader alpha out I guess.

I'm assuming you plan on using navmeshes or something for physics and navigation?