@Dschoonmaker said:
Is there a way to access the depth texture in the same way?
I do not think so, unfortunately. I think the depth texture can only be accessed once. You could have a separate Viewport that is just used for retrieving the depth texture by having a simple TextureRect node that grabs the depth texture and displays it in the Viewport, allowing it to be used.
That said, there might be a better way. I know in Godot 4.0 there will be more low-level access to the rendering stuff, which probably would make this process easier, but that doesn't help too much with Godot 3. Each Viewport might have its own depth texture separate from the main Viewport's depth texture though.