Search Issue Tracker

By Design

Votes

7

Found in

2020.3.41f1

2021.3.14f1

2022.1.24f1

2022.2.1f1

2023.1.0a21

2023.3.0a4

Issue ID

UUM-21404

Regression

No

CopyDepth pass fails when Renderer Feature is requiring Depth and Normals

--

-

Steps to reproduce:
1. Open the “CopyDepthPass_Bug” project
2. Observe the Game view

Expected result: The cube is not blurry
Actual result: The cube is blurry

Reproducible with: 2020.3.41f1, 2021.3.14f1, 2022.1.24f1, 2022.2.1f1, 2023.1.0a21

Reproduced on: macOS Ventura 13.0.1 (Intel)

Notes:
- The cube is blurry because when there’s a custom renderer feature, it seems to break to CopyDepth pass depending on the requested ScriptableRenderPassInput
- The cube is not blurry when the “TransparentMaterial” Material Surface Type is set to opaque

  1. Resolution Note:

    This is behaving as expected, the reason is the way the URP renderer handles the CameraDepthTexture.
    The main issue, in a nutshell, is that URP can produce the CameraDepthTexture in 2 ways: via CopyDepth, or via DepthPrepass.
    In your specific case, since you have a render feature, injected BeforeOpaque, this causes a DepthPrepass (or DepthNormalPrepass when requiring the normals too) to replace the CopyDepth. URP will never perform both a DepthPrepass pass and a CopyDepth pass per camera in the same frame.
    The reason why in your current frame debugger capture you cannot see the DepthPrepass running instead of the CopyDepth pass is that this particular
    scene has no standard geometry, except the one assigned to the layer rendered by the RenderObjects pass.
    Just adding a simple 3D cube to the scene will cause the depth prepass to run and to show in the frame debugger.

    The following is an explanation of what causes Depth/Normal prepasses to replace CopyPass passes:
    - a pass running BeforeOpaque requests depth. If the pass requests only depth and would run AfterOpaque, then the CopyPass will still happen.
    - a pass runninr at any point in the frame requires "Normal" input: the only way for URP to generate the normals texture (in the forward renderer)
    is via DepthNormalPrepass.

    In general, if in your specific use case it is necessary to have both a pass that requires "Normal" as input, and at the same time a CopyDepth is required to happen after Opaque,
    the only option is for you to implement a custom copy depth as render feature.

Comments (1)

  1. Sabrino

    Dec 16, 2022 11:23

    This bug causes a lot of issues with transparency and post-processing fx like depth of field. Need a fix for at least 2021 LTS onwards.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.