Render a visual "hole" mesh on a surface

I need to be able to render “hole” meshes on top of a board (pinball game) without having to cut an actual hole in the board geometry (the playfield is editable by the user). These holes are cosmetic and don’t affect the physics, but they’re large enough that just a 2d decal wouldn’t look right.

Below is a screenshot from an older pinball game that accomplishes what I’m after. You can see from the wireframe that the board surface is just quads. It does not have the hole cut out, the “hole” is a mesh rendered on top of the board, only drawing where the “hole” should be.

I imagine in their app it went something like:

  • draw the board
  • draw a 2D shape where the hole should be, clearing the depth buffer just for those pixels
  • draw everything else normally

Perhaps something could be done using the custom depth buffer to accomplish this? Or some sort of stencil masking?

Is there a way to control draw order of certain objects in UE4 and/or draw to the depthbuffer?

The only thing you could do is using a displacement map in your material.
But this would require the mesh to have much more vertices.
Layerimg the drawing, as you mentioned, is exactly what Decals do…

You could use the stencil buffer and use it as the alpha mask for your board material (set that to be opacity masked) though it’s bit of a hack, maybe there’s a better way using actual stencil operations that I’m not familiar with like with other engines.

Did you find a way to do it?