Z-depth fails and Extra blit while adding a pass after post-processing

Hey guys,
Need some help on the following:

Objective : To render/draw-renderers for certain objects after post-processing.

I am trying to create a renderer feature/pass using:
ScriptableRendererFeature and ScriptableRenderPass in URP.
This draws selected objects after the post-processing event.

Unfortunately, it forgets about the z-depth and renders every object on top of each other like the following image:

Whereas the expected output is:

As you see, in the first image, the objects dont render with proper z-depth values.

The solution is that I have to add a Blit Pass, where I just copy the source to destination without making any changes and then add the second pass where I draw all the required renderers. Can the blit be avoided?
Would love some suggestions/solutions to why this is working as such.

Thanks!

If you cannot just bind to the original depth (maybe its cleared), another option is the blit the depth yourself, then bind that. URP has an option to do this automatically after the opaque render pass, so maybe you can access it there.

I’m also encountering the same problem, Renderdoc seems to show me that the Depth RT gets detached on AfterRenderingPostProcessing event, not really sure why. If you have the luxury to modify the URP package, you could try what I did:
① Modify RenderObjects.cs’s (or a Custom ScriptableRendererFeature) AddRenderPasses function:

{
UniversalRenderer urp = renderer as UniversalRenderer;
if (urp != null)
{
renderObjectsPass.Setup(renderer.cameraColorTarget, urp.cameraDepthAttachment.Identifier());
renderer.EnqueuePass(renderObjectsPass);
}
}```

② Add these lines of code in RenderObjectsPass.cs (or a Custom ScriptableRenderPass):
```RenderTargetIdentifier m_Color;
RenderTargetIdentifier m_Depth;

public void Setup(RenderTargetIdentifier color, RenderTargetIdentifier depth)
{
m_Color = color;
m_Depth = depth;
}

public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
{
ConfigureTarget(m_Color, m_Depth);
}```

③ Add this to UniversalRenderer.cs somewhere:
```public RenderTargetHandle cameraDepthAttachment { get { return m_CameraDepthAttachment; } }```

Works on my machine™.