Search Unity

URP Post-Processing: Ambient Occlusion availability?

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

  1. ivank

    ivank

    Joined:
    Nov 16, 2013
    Posts:
    43
    Hello, its great that URP is now equipped with its own set of post/processing effects. However the AmbientOcclusion effect is still currently missing and is not even mentioned in in-progress documentation on Github.

    Can we get any info about the Ambient Occlusion effect status - it means will it make it into 2019.3?

    Thanks
     
  2. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    859
    Ambient Occlusion isn't available because URP doesn't render a geometry normals texture, which is the pillar of any ambient occlusion effect:



    I don't know if they're adding the option (can't see anything related on GitHub). But URP is apparently also getting Deferred rendering in the future, where normals are always available, making AO work out of the box. So I suppose they're either going to implemented it at some point, or wait until Deferred rendering is in place.
     
    ivank likes this.
  3. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    315
    An idea: calculate an approximate normal from the depth texture (that is available) and use that? If you are comfortable with creating your own post-process effect that is.

    Useful article on the subject (especially "Cetral differences for Terrains"): http://www.iquilezles.org/www/articles/normalsSDF/normalsSDF.htm
     
  4. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    283
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,334
    yes, it supports MultiScaleVO
    which relies on the depth buffer only as far as i remember.

    it was not really stable (image wise) but under certain conditions better than nothing.
    doing an extra normal pass or using multiple rendering targets when rendering forward lighting sounds a bit bandwidth heavy to me, so i guess we have to live with a rather simple ssao solution.
     
    noio likes this.
  6. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    283
    @larsbertram1 The hack I posted above simply re-enabled Unity's own PPv2 AO under LWRP. But as 2019.3 has ditched PPv2 I suppose it won't work anymore. Are there currently any working URP 2019.3+ solutions that you know of? Any of your assets?
     
    noio likes this.
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,334
    i don't know.
    i just wanted to clearify that normals are not mandatory if you use some special SSAO techniques.
    they are super good to have but maybe just too expensive – at least in case of URP and forward.
     
    Matt-Cranktrain likes this.
  8. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    936
    GameDevCouple_I likes this.
  9. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,497
    Unity really needs to sort out this custom post processing asap. URP seems like incomplete and feels like it has gone backward now.
     
    superjayman and JimmyCushnie like this.
  10. superjayman

    superjayman

    Joined:
    May 31, 2013
    Posts:
    142
    I can't believe what a mess it is!, I mean SSAO is a trivial old school method and there is no proper implementation with URP. So, what is the best way to get normals? if URP is so flexible how come you can't even do SIMPLE SSAO???
     
  11. create3dgames

    create3dgames

    Joined:
    Aug 20, 2012
    Posts:
    261
  12. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    936
    Source files linked through pastebin.
     
    GameDevCouple_I likes this.
  13. create3dgames

    create3dgames

    Joined:
    Aug 20, 2012
    Posts:
    261
    o_Oo_Oo_Oo_O
     
  14. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    283
  15. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    474
  16. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    283
    Maybe it's been a month because it's ready and just waiting for another branch to be merged into master first. Could be close. You never know. Deferred lighting in URP is apparently ready to be merged, according to a recent commit.
     
  17. DiveshNaidoo

    DiveshNaidoo

    Joined:
    Apr 1, 2018
    Posts:
    10
    Matt-Cranktrain likes this.
  18. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,129
    If I may, I don't think SSAO is a good fit for URP. If we get deferred, it'll maybe be fine since a big chunk of the performance cost will be paid regardless, but other than that, it's generally an effect that makes things look actively worse and is most definitely not worth the huge performance cost.

    Especially with low settings, the only thing it does is make corners look like the have mold. IMO if your game needs SSAO to look good, you are probably doing something wrong. With all that said, I would be interested to find out why people keep asking so much for it.
     
  19. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    474
    I very much like the look of AO, so I disagree with you.
     
    transat likes this.
  20. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,202
    This is pretty much the primary reason for switching from URP to HDRP. All shadergraphs still work once master node is swapped out, I am able to get same graphics as before but with actual ability to perform this effect and many others. I also find that in general, HDRP is actually easier for me to use than URP which seems to have far more issues version to version. I also no longer feel like I have downgraded my graphics by using SRP, which I definately felt with URP

    HOWEVER using the custom normals texture by @alexanderameye works for URP! So you can build a AO on top of that.

    @alexanderameye please make more tutorials, your edge detection tutorial was great but really waiting for that follow up tutorial that does it as an image effect! Please keep them up you could easily become a major player on the tutorial scene if you fill your site with a little more content!
     
  21. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    474
    Yeah maybe I'll do that, but just feels really weird doing a low-poly game in HDRP... I feel like they did the change to SRPs like a year too early.
     
  22. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,202
    Not at all, your just getting a larger set of features. Can make any game you want in it, low poly included. However you can always try generating custom normal texture and then writing an AO effect on top of that, that will work just fine too and above a user has linked to a tutorial on the normal texture part.
     
  23. Soul_Without

    Soul_Without

    Joined:
    May 9, 2015
    Posts:
    2
    I wrote a basic ScriptableRenderFeature based on the SSAO implementation from the SRP github. Just add it to your RendererData and plug in the shader and noise texture and it should work. It's not a great implementation: it has to blit twice because blitting can't have the same source and destination.

    Screen Shot 2019-11-21 at 1.34.02 PM.png

    ScriptableRenderFeatures are a really neat way of extending the pipeline for things like this, but the documentation isn't great and you kind of have to do a lot of digging through the code to understand how to use them.

    Happy to answer questions
     

    Attached Files:

  24. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    474
    @Soul_Without Looks cool!

    Just add it to your RendererData and plug in the shader and noise texture and it should work

    How do I go about adding it to my RenderData, completely new to me.

    @GameDevCouple_I Why did you choose HDRP over the old "default"? Was more leaning towards just going back to that, since I assumed HDRP would add a lot of bloat I dont need to the project.
     
  25. Soul_Without

    Soul_Without

    Joined:
    May 9, 2015
    Posts:
    2
    When you first created your Universal Render Pipeline Asset (the one you select in project settings) it should have created another asset for the renderer. In the inspector window for that asset click the plus in the Renderer Features section and you should see the new feature
     
    mrCharli3 likes this.
  26. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    474
    Screenshot_5.jpg View attachment 517100
    @Soul_Without
    Edit: I downloaded 2019.3 but unfortunately it does not pick up your script, see attachment.
     
    Last edited: Nov 21, 2019
  27. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    283
    According to the public roadmap AO is only still being considered. Confusing.
     
    JimmyCushnie likes this.
  28. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,129
    And reflection probe box projection in a year or so, which is kind of bizarre, since it's roughly ten lines of shader code and it runs even on 5 year old mobile phones, so I don't know why they need a year.
     
    JimmyCushnie likes this.
  29. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    76