Search Unity

Question How can I use Render Objects feature with SSAO?

Discussion in 'Universal Render Pipeline' started by rostykul, Jun 20, 2022.

  1. rostykul

    rostykul

    Joined:
    Oct 9, 2018
    Posts:
    22
    When I enabled SSAO or SSS, it ignores any objects that only show up through Render Objects (Experimental).

    In this scene, the cube's layer is filtered out by the URP Renderer and then rendered after by using the Render Objects feature. Even though it's rendered before SSAO and writing depth is enabled, you can see the SSAO acts as if it doesn't exist.
    upload_2022-6-20_18-44-16.png

    If this isn't a bug, what settings can I change to let SSAO recognize these objects?
     
  2. DanielDickinson

    DanielDickinson

    Joined:
    Aug 4, 2013
    Posts:
    278
    Perhaps set Copy Depth Buffer to AfterTransparent? I think Ideally you'd want it somewhere between the two, but that may work.
     
  3. rostykul

    rostykul

    Joined:
    Oct 9, 2018
    Posts:
    22
    How can I do that, do you mean modify URP code? I've tried changing the render pass event of the SSAO and Render Objects to AfterTransparent if that's what you mean. I can make the cube render on top but SSAO still ignores the edges it creates with the floor. I'd like it to play a part like normal when it's not in a Render Objects feature.
     
  4. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    Same here, just bump into this issue a while back.

    You can try to include the cube's layer in Opaque Layer Mask under Filtering as well. That fixed mine SSAO & Render Objs issue but somehow is not the right way to get it done.

    However, I don't see any Opaque Layer Mask Property or Filtering label in your post pic, weird.

    upload_2022-10-10_17-51-53.png
     
  5. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    Did you manage to fix this? I mean the fix would be to tick "After opaque" in the SSAO render feature. But did you manage to get the ambient occlusion on the object that is rendered with the render objects feature?
     
  6. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    Yes, the SSAO & render Obj problem is fixed.

    but as I mentioned there's quite flawed with my posted solution, so here's a more perfect way from Unity Render Example:

    https://github.com/Unity-Technologies/UniversalRenderingExamples/wiki/FPS-Demo

    Make sure SSAO order is AFTER them, like:
    upload_2022-10-17_8-3-39.png
     
  7. ElmarM

    ElmarM

    Joined:
    Apr 27, 2022
    Posts:
    5
    I am having the same issue right now. No matter what I do (move SSAO around, change settings). SSAO is drawing over my Render Objects. I can't have the same layer drawn in the base pass.
    I am still on 2021. In case this is fixed in later versions?
     
  8. ciaranhappy1

    ciaranhappy1

    Joined:
    Oct 22, 2018
    Posts:
    15
    I was able to fix it in my case by ticking 'after opaque' in the SSAO settings. Its under the quality dropdown, as in the image below:
    upload_2023-3-12_20-16-33.png

    Is that one of the settings you were changing while trying to fix this? If it is and it didnt work in your case, it could be a version thing (im on 2022). Might be worth making a test project on a later version to investigate that.
     
  9. ElmarM

    ElmarM

    Joined:
    Apr 27, 2022
    Posts:
    5
    Yeah, I tried that and some other things. For me setting it to Depth instead of Depth Normals fixed the problem with the SSAO, but I also had to change the decals to Screenspace and that made them look wrong. Note that I am still on 2021.
     
    Last edited: Jul 12, 2023
  10. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    235
    2023.2.2f1 - nothing of above worked, blank URP scene, default settings... :facepalm
     
  11. Xlordgamer

    Xlordgamer

    Joined:
    Jul 1, 2021
    Posts:
    1
    What worked for me:
    Filtering the tools layer
    Set SSAO as the uppermost feature
    enable After Opaque for SSAO
    On the first render objects AfterOpaques Depth Always Write Depth on
    On the second render object AfterOpaques Depth Less Equal Write Depth on
    You are welcome
     
  12. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    I still cannot get SSAO to run on the first person objects, perhaps you misunderstood my question? Do SSAO work on the 1st person layers of your screenshot?