Search Unity

Only the first camera writes to the depth buffer, overriding others

Discussion in 'High Definition Render Pipeline' started by ICudlitz, Jan 10, 2021.

  1. ICudlitz

    ICudlitz

    Joined:
    Jun 25, 2019
    Posts:
    2
    I am currently working on an effect that uses two cameras with the HDRP, although I will demonstrate the problem with a simpler use-case to highlight the issue.

    My scene is rendering two cameras. One is rendering to a render texture, the other is rendering to the screen. This is the first camera



    after that one, this camera renders


    As you can see, the depth buffer transferred over and is now applying ambient occlusion from the first camera to the second camera's output. Renderdoc indicates that this is because the depth buffer is not cleared before the second camera renders.

    This is definitely a bug, but is there a workaround?