Search Unity

URP Post-Processing: Ambient Occlusion availability?

Discussion in 'Universal Render Pipeline' started by ivank, Sep 6, 2019.

  1. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    It has already been released. It’s in preview though, so not recommended unless you really need to use this now over a 3rd party package like HBAO.
     
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,344
    Is HBAO an asset on store ?
     
  3. Komikom

    Komikom

    Joined:
    May 20, 2015
    Posts:
    38
    nasos_333 likes this.
  4. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,344
  5. SufferinPup

    SufferinPup

    Joined:
    Jul 7, 2012
    Posts:
    24
    Sorry I'm a bit confused trying to follow this thread - does this mean that there will never be an official AO solution for 2019.4 using URP?
     
  6. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    192
    Correct.
     
  7. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    59
    Anyone know how to get the AO to work in combination with the official URP first person rendering setup? No AO is applied to the first person objects. HBAO works fine with it.

    Unity 2020.2.0b2
    URP 10.0.0-preview.26.

     
    laurentlavigne likes this.
  8. dfkan12

    dfkan12

    Joined:
    Nov 1, 2017
    Posts:
    15
    Installed unity 2020.2.0b2 and have the SSAO, but can't see it take effect. Anybody got it working in this unity version
    @Tim-C and @elvar_orm
     
  9. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    I just tested it and it seems to work fine. You need to place it on the renderers FPSSetupP1 and FPSSetupP2.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      414.4 KB
      Views:
      610
    • 2.png
      2.png
      File size:
      418.2 KB
      Views:
      589
  10. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Heyhey!
    I will need to know more about your project in order to understand the issue.

    Have you looked at the docs to make sure everything is correctly set up? Are you using custom shaders?
    https://docs.unity3d.com/Packages/c...iversal@10.0/manual/post-processing-ssao.html
     
  11. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
  12. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    It's not in my immediate plans right now but I might be able do that alongside the implementation for Deferred.
     
    Lars-Steenhoff likes this.
  13. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    If you can also add color bleed (pseudo GI) that'd be awesome.
    How are performance in URP deferred? I think you guys pulled it out of github and since I'm still profiling for mobile I'd like to know if I should postpone a few conversions.
     
    NotaNaN, Matt-Cranktrain and camta005 like this.
  14. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    59
    Sorry I should have been more clear. The AO does work. However it does not appear on the first person models (e.g. guns) as seen in your own screenshots. I need the AO to apply to both the environment and the first person models.
     
  15. frbrz

    frbrz

    Joined:
    May 10, 2016
    Posts:
    76
    Have you tried it with camera stacking?
     
  16. RichTufty

    RichTufty

    Joined:
    Jul 12, 2012
    Posts:
    23
    Hi all, been searching high and low to find this discussion on here. Have converted a mobile project to URP and wanted to use AO. Saw in the docs that v10 of URP only works with Unity 2020.2 beta so installed the beta. Sorry if it's mentioned somewhere else but just can't see or understand how to install URP 10 anywhere. It's not showing up in package manager, and if it's in a repo somewhere how do I import that package? There seems to be bits everywhere, I appreciate this is in development still, lots of hard work going in to this, but there doesn't seem to be any clear instructions on how to use the latest stuff.
    Any help would be massively appreciated as I want to try out URP 10 (including AO) with 2020.2 beta.
     
  17. frbrz

    frbrz

    Joined:
    May 10, 2016
    Posts:
    76
    It's a bit hidden. You need to go to the package manager and activate preview packages there. Once preview is activated, there will be more version options for official modules like URP. Search inside advanced.
     
    RichTufty likes this.
  18. RichTufty

    RichTufty

    Joined:
    Jul 12, 2012
    Posts:
    23
    THANK YOU!!!!! THERE WE GO, ah man that was really hidden!

    upload_2020-9-30_18-47-37.png

    Achievement unlocked!
     
  19. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    ^ how is URP speed wise?
     
    Ziplock9000 likes this.
  20. Matt-Cranktrain

    Matt-Cranktrain

    Joined:
    Sep 10, 2013
    Posts:
    129
    I too would love to see some Ambient Occlusion performance results from anyone developing with URP on the 2020.2 beta. Some with AO/without AO screenshots and the difference in what the profiler shows would be great.
     
    NotaNaN likes this.
  21. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
  22. K-Skanz

    K-Skanz

    Joined:
    Jun 12, 2016
    Posts:
    7
    I'm not a pro in unity or something like that, but I made a comparison:

    2020.2.0b5 - AO On


    2020.2.0b5 - AO Off


    2020.1.7f1 - AO On


    2020.1.7f1 - AO Off


    It's a Random Level generated game, so the number of entities may vary, but in 2020.1.7f1 there are more entities than 2020.20b5 and AO didn't make any impact in the FPS. I don't know how AO works, but in URP looks like they created meshes for the AO effect, and it's not a post-processing effect.
     
  23. frbrz

    frbrz

    Joined:
    May 10, 2016
    Posts:
    76
    I had similar experience with 2020.2.0b5. AO consumed a very extrange amount of FPS (default scene for URP).
    I didn't tested AO in 2020.1.7f1 yet. Seems promising.
     
  24. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    how did you get AO in 2020.1?
     
  25. K-Skanz

    K-Skanz

    Joined:
    Jun 12, 2016
    Posts:
    7

    Sorry, I forget to mention that AO is from Post Processing without the URP installed
    (Sadly this don't work with URP)

    2020.2.0b5 = With URP + Native AO from URP
    2020.1.7f1 = Without URP + Native PP+AO from Unity
     
  26. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    ah yeah 100fps vs 60 sounds in line with the party
    the unity AO is, errr how do you say, good for amateur night, but it's more like 10ms not 3x so I think you have a bug somewhere, cpu at 34ms sounds like a nullref.
     
  27. K-Skanz

    K-Skanz

    Joined:
    Jun 12, 2016
    Posts:
    7
    So far for the URP, I just followed some tutorials to make the import, convert materials, etc. I didn't get deep in URP because there's not an official AO. My first impression of the URP was very good, improved the FPS and the only problem (Aside from AO) was the shadow with a hard edge and a scene little too dark. But for some reason when I add AO, the FPS drops a lot, I'll wait for the official release of AO to dig into the URP, maybe be a bug in my game, maybe an improvement to do in URP, I have hopes for URP.
     
  28. Initive

    Initive

    Joined:
    Jan 26, 2013
    Posts:
    10
    Is there an ETA on AO working in deferred?
     
  29. TheJinxedArtist

    TheJinxedArtist

    Joined:
    Jun 4, 2020
    Posts:
    3
    I've just found, in unity 2020.1 (I don't remember if it was there before) there is an ambient occlusion option and it works with universal RP!
     
  30. dfkan12

    dfkan12

    Joined:
    Nov 1, 2017
    Posts:
    15
    Hej, we reverted back to unity 2020.1. we are developing an oculus quest MVP and wanted to try out some optimised Ambient occlusion. Thats why we tried this.
     
  31. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    How? The Unity developer working on this features said it wont work before 2020.2?
     
    MP-ul likes this.
  32. Mykael-BC

    Mykael-BC

    Joined:
    Sep 23, 2020
    Posts:
    5
    i've been messing around with the new SSAO in URP. Pretty nice but, it doesn't work on emissive materials AKA toon shaders with the custom node for custom lighting. SSAO is a must when doing toon shading and its kinda bad that it only works on regular shaders.
     
    NotaNaN and Ziplock9000 like this.
  33. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,258
    This makes sense if you're doing custom lighting, you'd now have to incorporate the occlusion factor as well which is usually multiplying your base color by it.

    You can sample the generated occlusion texture like so:
    Code (CSharp):
    1.  
    2. float2 normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(<clip space position>);
    3. AmbientOcclusionFactor aoFactor = GetScreenSpaceAmbientOcclusion(normalizedScreenSpaceUV);
    4.  
    5. mainLight.color *= aoFactor.directAmbientOcclusion;
    6. albedo *= aoFactor.indirectAmbientOcclusion;
     
  34. tdosh77

    tdosh77

    Joined:
    Oct 28, 2016
    Posts:
    5
    I'm trying to enable the SSAO Render Feature as detailed here but have no option to enable URP 10 in the Package Manager. Preview packages are enabled, only have options up to v9 though. I'm using 2020.1, is this only available in 2020.2?
     
  35. NotaNaN

    NotaNaN

    Joined:
    Dec 14, 2018
    Posts:
    325
    Yes.
    URP Screen-Space Ambient Occlusion is only available in Unity version 2020.2 or higher.
     
  36. tdosh77

    tdosh77

    Joined:
    Oct 28, 2016
    Posts:
    5
    Got it, thank you.

    My use case for this is the Oculus Quest... does it perform well enough to use on that platform or am I chasing a red herring? It would be pain to migrate to 2020.2 right now, so if it's not usable for my needs anyway, I won't bother.
     
  37. NotaNaN

    NotaNaN

    Joined:
    Dec 14, 2018
    Posts:
    325
    Unfortunately, I am yet to use the feature either. (I just know that it's a 2020.2+ exclusive). :(

    I have heard though, that the URP SSAO is pretty performant (performant enough to match other SSAO options). If it's a huge pain to test it out, however, only advice I can give is to wait a few more weeks / months so 2020.2 is a bit more stable, then migrate when you're ready. :oops:
     
  38. toyhunter

    toyhunter

    Joined:
    Mar 5, 2018
    Posts:
    76
    Last edited: Jan 18, 2021
  39. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Hey!
    That's correct. I made a fix for this last week and backports for the issue.
    The reason it looks wrong is because render scale is set to something else than 1.0. That affects the SSAO texture but render scale doesn't work with scene camera. Hopefully I can get this fix in to URP 10.3 release but it might be too tight, worst case the release after that.
     
    NotaNaN likes this.
  40. toyhunter

    toyhunter

    Joined:
    Mar 5, 2018
    Posts:
    76
    Thanks for your prompt response!
    Believe is this setting, right?
    Screenshot 2021-01-18 at 5.10.19 PM.png
     
    Last edited: Jan 18, 2021
  41. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Yes, exactly that one :)
     
  42. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    While you're here, can you take a look at that bug with overlay cameras? Depth textures don't get rendered.
     
  43. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Do you have a case ID for me?
     
    laurentlavigne likes this.
  44. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    1307516
     
  45. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Thanks. I'll see if I can take a look next week.
     
    laurentlavigne likes this.
  46. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,320
    Thanks Elvar.
     
  47. Mykael-BC

    Mykael-BC

    Joined:
    Sep 23, 2020
    Posts:
    5
    Hey thanks a lot! i'll try it out as soon as i'm off work. it looks neat!
     
  48. Mykael-BC

    Mykael-BC

    Joined:
    Sep 23, 2020
    Posts:
    5
    Well! it did work! i had to alter it since i<m using a custom node in shadergraph and thers a lot of things that i can get precalculated. but you lauched me in the right direction! so here is the final code :
    Code (CSharp):
    1.  
    2. AO = GetScreenSpaceAmbientOcclusion(ScreenPosition).indirectAmbientOcclusion;
     
    Last edited: Jan 28, 2021
    StaggartCreations likes this.
  49. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,306
    I did something like this in my toon shader, but it does not work.
    Do you know by chance how it should be done in unlit shader graph?

    // edit: Obviously it does not work in unlit,... so it can't be done using depth normals.
     
    Last edited: Jun 26, 2021
  50. FireJojoBoy

    FireJojoBoy

    Joined:
    Oct 30, 2019
    Posts:
    65