For 3D, I would recommend using a color mask with a Viewport and then have that as an input for the MeshInstance nodes you want to make transparent. Then you can have a sphere or a textured quad render to the color mask so you can get different shapes.
It's a few years old, but I wrote a tutorial on color masking in Godot using a Viewport texture that may be helpful. In particular, the example shown at section 5.1
may be similar to what you are looking for, I think.