A fairly common need when writing custom render passes in URP is rendering to one or more rendertargets while ztesting against (and possibly zwriting) the actual camera depth buffer.
i.e. inside ScriptableRenderPass.OnCameraSetup:
ScriptableRenderPasses cannot consistently access the depth buffer
i.e. inside ScriptableRenderPass.OnCameraSetup:
Code (CSharp):
- cmd.GetTemporaryRT(someRTHandle.id, descriptor);
- cmd.GetTemporaryRT(anotherRTHandle.id, descriptor);
- RenderTargetIdentifier[] mrt =
- {
- someRTHandle.Identifier(),
- anotherRTHandle.Identifier(),
- };
- RenderTargetIdentifier depthTarget = ?????...