Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[LWRP/URP] Depth pre-pass for depth testing

Discussion in 'Universal Render Pipeline' started by MaxRoetzler, Jan 15, 2020.

  1. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    Hi,

    I am running in a bit of a problem rendering vegetation on screen. Its not even covering a lot of the screen, but the performance impact is quite high. The vegetation is rendered using alpha-testing, which causes a lot of overdraw. Other engines seem to take advantage of the depth pre-pass to depth-reject occluded pixels in the lit-shader passes, making it much more affordable.

    From my tests and some vague posts I found about the topic, it seems that LWRP/URP doesn't use the depth pre-pass for depth-testing, but only for shadows and post-processing.

    Is there any way to get this to work? Without it, rendering lots of vegetation seems like a rather impossible task in Unity.

    Thanks for any hints and tips :)
     
    bluescrn and ROBYER1 like this.
  2. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    We have plan to support this as an option in the renderer, however it's not done yet. Only way to do it atm is to change URP source.
     
    cultureulterior and GridWanderer like this.
  3. minorchik

    minorchik

    Joined:
    Feb 15, 2020
    Posts:
    5
    any news about it?
     
  4. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    160
    Still being worked on as it requires several steps on our part.
    phil_lira and me are actively working on those. Can't promise a release date but hopefully very soon.
     
    GridWanderer and Dinamytes like this.
  5. minorchik

    minorchik

    Joined:
    Feb 15, 2020
    Posts:
    5
    thks for answer.
    may we will get manual passes in shader graph or standard base shader code like we have in standard rp?
     
  6. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    I believe depth prepass is not a good deal ,but I would like to test it anyway to see if improves the fill rate (I doubt so). Is the feature now available?
     
  7. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Hi both, is there any update on this? Ran into this issue on Oculus Quest with a water shader using Scene Depth node for an edge-foam effect, anything rendering in front of the water has aliased shimmering white around it where the non-MSAA depth pass is added on top (I assume).

    msaadepth.PNG
     
  8. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    If you're rendering a depth or depth/normals pass anyway (for postprocessing, particularly SSAO now that the URP supports it), that should be able to serve as a free prepass

    But as far as I could see (only tested in the editor), the depth buffer is not preserved between the depth-normals pass and the main render pass.

    Not sure if it's possible to change this by hacking at the URP code - as it would involve dealing with color and depth buffers as separate objects (rather than a RenderTexture which contains both)
     
    hippocoder likes this.