Search Unity

Question Objects occluded from depth pass when using render features

Discussion in 'Universal Render Pipeline' started by Twin-Stick, Mar 23, 2021.

  1. Twin-Stick

    Twin-Stick

    Joined:
    Mar 9, 2016
    Posts:
    111
    I'm using URP and have some render features enabled with a certain layer to show the player behind large objects (blocker layer). This works fantastic.... Until the post processing is applied!

    So my opaque layer mask excludes the 'blocker' layer so I can use it in the render features list. With no post processing - this works perfectly. But when I use the DepthOfField effect - that layer is excluded from the depth pass.

    The render features are executed in the Before Rendering Opaques queue. (However changing the queue to After Rendering Opaques doesn't change the outcome)

    Is there a way I can work around this?

    **EDIT**

    I've since downloaded the URP Examples project from github and can confirm this behaviour happens in the demo. It would seem anything excluded from the default opaque filter will not get written into the depth buffer. I would LOVE to know a workaround to this!

    Render Feature Setup
    upload_2021-3-23_17-35-5.png

    Frame Debugger Before PostFX
    upload_2021-3-23_19-20-56.png

    Render Results
    (Note depth of field effect on front row, however right tile is not in depth pass)
    upload_2021-3-23_17-33-14.png

    Depth Pass
    upload_2021-3-23_17-37-12.png
     
    Last edited: Mar 23, 2021
    Prodigga likes this.
  2. Twin-Stick

    Twin-Stick

    Joined:
    Mar 9, 2016
    Posts:
    111
    OK - I have got somewhere with this!
    I found by disabling MSAA in the pipeline asset, the frame debugger shows a new pass called Copy Depth which was not there before. And now the post FX are working all as expected.

    Do you think this may be a bug? Should I submit a ticket to Unity?

    upload_2021-3-24_9-41-23.png