Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Depth buffer getting cleared even when set to Don't Clear

Discussion in 'General Graphics' started by Clonkex, Mar 15, 2020.

  1. Clonkex

    Clonkex

    Joined:
    Jul 31, 2012
    Posts:
    31
    I'm rendering portals, and I have two cameras that render specific parts of the scene, both into the same render texture. The first camera renders most of the scene, and the second one renders a few specific objects. The reason for two cameras is that for some objects I need to set a different near clipping plane.

    The problem is that no matter what I do, I can't seem to get the second camera to stop clearing the depth buffer of the render texture. The first camera is set to the regular Skybox clear flag and the second camera is set to Don't clear, yet in the frame debugger I still see Clear (Z+stencil), which of course results in the second camera being "always on top" of the first.

    What's going on?

    Screenshots here: https://imgur.com/a/eaMSi7X

    EDIT: I'm on 2019.2.6f1 if that's relevant.
     
    Zebadiah likes this.
  2. Clonkex

    Clonkex

    Joined:
    Jul 31, 2012
    Posts:
    31
    After testing in a simplified project I believe it's a bug, so I've submitted a bug report for it. Sigh.