How to render inset windows on top of a wall without modifying the mesh of the wall?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By path9263

I would like to be able to draw things like inset windows on top of walls without modifying the geometry of the wall, see image below:

enter image description here

The windows do not have to be transparent, you don’t have to be able to see through the wall!

There may also be multiple objects behind the windows which could clip through the windows, not just the wall. In the example image below I don’t want to be able to see the blue box in the window. It might work best if the windows are their own geometry (mesh) floating just in front of the wall but the windows must always render on top of the wall.

enter image description here

I tried playing around with normal maps and depth maps but I haven’t had much success with having nice, sharp, deep, 90 degree inset features, it works okay if you want soft edges but I would like things sharp! It is also important that light and shadow effect the windows properly as they do the walls.

Something like this I think would work for me but Godot does not have access to the stencil buffer yet. I did find this pull request that mentions it could be used for something like this but I haven’t been able to figure out how to do it.

Thank you very much for any help you can provide! Even just pointing me in a direction to start researching would be great!!