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

Camera stacking depth buffer & draw order

Discussion in 'Universal Render Pipeline' started by rboerdijk, Nov 21, 2020.

  1. rboerdijk

    rboerdijk

    Joined:
    Aug 4, 2018
    Posts:
    96
    Hello,

    I have a stacked camera, base camera rendering "deepspace" planets in a tiny scene ( planet is 1 unit, but really near the base camera so it appears huge) and the overlay camera rendering "everything else, spaceships, stations etc) on a normal scale. When not clearing the z-buffer the station is rendered behind the planet (as expected):
    upload_2020-11-21_17-39-35.png

    So we enable the z-buffer-clear for the overlay and the station appears nicely in front of the planet, as expected:
    upload_2020-11-21_17-41-43.png

    However the green particle effect (which is floating centered a bit above the station) still gets rendered behind the planet, and I don't understand why. I mean, the z-buffer was cleared and it is working fine for the station...?

    So it seems to be related to the state of depth-texture on/off in the base camera, which when switching to "off" results in the green effect before the planet, as we want.
    upload_2020-11-21_17-43-57.png

    So somehow the particle-system is using the depth-texture when it's enabled, which I'd like to somehow disable. The depth-texture is needed for a different effect (which depends on it) so it should be enabled, but the green particlesystem (or all particle systems) should ignore the depth-texture.

    I didn't see anything obvious in the particlesystem rendering options... Any ideas how to do this?
     

    Attached Files:

  2. rboerdijk

    rboerdijk

    Joined:
    Aug 4, 2018
    Posts:
    96
    For anyone else running into this, using the framedebugger noticed the drawcall - as expected - is using the _CameraDepthTexture. Combined with information from another post figured out that soft particles require the _CameraDepthTexture and disabling that indeed gives the correct rendering order since then it doesn't use the "weird miniature" DepthBuffer from the deepspace camera.
    upload_2020-11-21_21-44-33.png
     
    Last edited: Nov 21, 2020
    jaydnwlsn likes this.