[Solved] grey render texture depth

Hi, I’m trying to get the depth from a RenderTexture onto a Texture2D using texture.ReadPixels.
Though all I get is a solid grey texture (Color32 = 205, Color = 0.8039216).
How ever the RenderTexture displays the depth just fine when viewing it in the inspector.

I have set RenderTexture.active to the render texture

Texture2D settings:
Size: Same as render texture
Texture format: R8 (also tried argb32 and rgba32)
Mip chain: False
Linear: False

RenderTexture settings:
Color format: DEPTH_AUTO,
Depth buffer: 24 bit,
Filter mode: Point
Size 32x32
No AA, Mip or Scaling

I’m using URP 7.1.6 and Unity 2019.3.0f1
Been fiddling with this all day but can’t find a way to fix it.
Anyone got an idea of what I’m doing wrong?

So I’ve tried on Core and HDRP and they also turn out grey.
I’ve tried OnPostRender, RenderImage and with same result.
If I’m not mistaken, I think it has something to do with ReadPixels not reading depth?

EDIT Finally solved it. I had to blit the source to destination and specify a material with a custom shader that read the camera depth. Then do the read pixels part. Though I had to ditch URP for it to work:(

I’ve been struggling with this for a couple of days, and am trying to read the depth buffer in a similar fashion. I’m currently using the URP and you say you had to ditch it? Are you using the HDRP now? Can you provide any more details on how you read the depth buffer? I’m trying to read the depth under the cursor on calculate the world space position based upon that rather than use a mesh collider.