What's the correct way to get the pixel depth and the scene depth?

Godot Version

4.3

Question

okay so i just need to know formally what the correct way to read depth in gdshader is now that they’ve changed it. i need to get two depths:

  • the depth of the fragment pixel
  • the depth of the scene texture

the functions i use to access this information are VERTEX.z and texture(depth_texture,SCREEN_UV) respectively. the problem is that these two depths cannot be meaningfully compared, because they are in totally different scales. so i can’t, for example, check if a scene pixel is in front of or behind the fragment pixel. how do i get these depths in the same space now?