Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Horizon Based Ambient Occlusion - HBAO image effect

Discussion in 'Assets and Asset Store' started by jimmikaelkael, Feb 21, 2016.

  1. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    Hi, sorry for the inconvenience, it should work for you. Have you tried to follow the documentation install steps ?
     
  2. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    In HDRP or Standard pipeline, I can suggest to take advantage of temporal filtering: Switch your quality back to low, set half resolution and enable temporal filter. You should get half the perf cost of what you actually have, and if it's visually good enough gain even more with lowest quality and maybe blur can be lowered too.
     
  3. tagabalon

    tagabalon

    Joined:
    Oct 12, 2012
    Posts:
    3
    i tried using on an empty project and.. it worked. i'm trying to figure out why it doesn't on my main project. i followed the instructions on the doc very carefully.
     
  4. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    666
    I tried your setting and it didn't make any difference in performance. I am using the settings I used in my last post I uploaded the settings there. Setting anything to half resolution straight away the artifact can be seen, I don't have performance issues with my current setup but following your setup there was no performance gain.

    What I did discover was that the color bleed doesn't do anything when off or on or tweaking any of the color bleed settings. Only enabling multi-bounce allows a kind of color bleed but I think the color bleed settings are separate from that but either way they don't do anything on or off.
     
  5. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    643
    Hi, does this support HDRP10?

    Also, the demo link for PC seems broken. Please check.
     
  6. zented

    zented

    Joined:
    Feb 13, 2013
    Posts:
    1
    Hi,

    It looks like the AO is applied on top of everything as you can see below.
    Also there is no AO applied on the gun itself.
    In my case, the gun is on the layer 'Overlay', so I can tweak stuff in the URP Renderer (wall clipping, gun only fov).
    Any idea what could cause this?

    Gun_Layer_Overlay.jpg
    Renderer.jpg
     
    Last edited: Dec 2, 2020
    DebugLogError likes this.
  7. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    59
    This asset is a HUGE step up over unity default HDRP AO, but is there any way to make it render before volumetric fog like the default AO? I don't want to give up using Volumetric Fog (because HBAO renders over it) andI can't find any custom HDRP volumetrig fog solution that I can then put in the custom passes after the AO (does it work that way?). Thanks! I hope I can solve this because i am amazed at this asset, the color bleed also makes a huge difference at a low cost too.
     
  8. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    I'm sorry for this issue... this is actually a limitation in HDRP which miss a custom post process injection point (see https://forum.unity.com/threads/mis...-injection-point-in-hd-render-pipeline.979803)

    Concerning workarounds, there's a simple one if you are only using HBAO as AfterOpaqueAndSky custom post process, it involves modifying 2 lines in HDRenderPipeline.cs (Packages/High Definition RP/Runtime/RenderPipeline/HDRenderPipeline.cs).

    Search for the RenderSky method call in that file, and a few lines below:
    kTqUQf5ihc.png

    Then find RenderSky method body and after m_SkyManager.RenderSky call:
    Ktnl4XNmi1.png

    After these changes HBAO will render before volumetric fog.
     
    Oniros88 likes this.
  9. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    59
    Thanks, that did the trick, saved our day! Really helpful and easy fix.

    My guess is that we will continue to use this until we can find a replacement for volumetric fog that is a custom post process. Does this method also hide custom bloom behind fog too if we were to use a custom one? because that would be desiderable too
     
    PutridEx likes this.
  10. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    420
    Any update for URP 10? I find HBAO superior to any of Unity's built-in SSAO, including the new one provided in URP 10, but it causes objects to go semitransparent through my terrain like clouds and rocks.
    upload_2020-12-31_15-36-26.png

    And yes, I am running HBAO 3.3.1.

    I noticed this also happens when I use the built-in SSAO that comes with URP 10. It goes away if I switch from Depth Normals to Depth. Any way we can have this option with HBAO?
     
    Last edited: Dec 31, 2020
  11. AlexanderElert

    AlexanderElert

    Joined:
    May 31, 2017
    Posts:
    35
    Code (CSharp):
    1. A multisampled texture being bound to a non-multisampled sampler. Disabling in order to avoid undefined behavior. Please use Texture2DMS in the shader.
    VR for Oculus Rift Single Pass Instanced Unity Standard Render Pipeline 2019.4.10f Forward Rendering

    Before you press play it looks ok and the HBAO works, but when we press play it doesnt work, in editor game view + Oculus Headset

    Info related: https://docs.unity3d.com/Manual/SinglePassInstancing.html

    PD: Unity Post Processing do not work too in single pass instancing..

    Update: switching to Multipass fix the Unity Post Processing but HBAO still not working.
     
    Last edited: Jan 2, 2021
  12. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    420
    Bump.
     
  13. Mordus

    Mordus

    Joined:
    Jun 18, 2015
    Posts:
    171
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    This option is already there, you can switch HBAO "Per Pixel Normals" setting to "Reconstruct 4x".
     
    Exeneva likes this.
  15. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    Sorry for this issue, I still need to check this.
     
  16. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    You need to make sure your shader is writing to depth buffer and on opaque queue.
     
  17. dmi3iy

    dmi3iy

    Joined:
    Mar 30, 2013
    Posts:
    4
    Hi, I have your asset, but can't test it in the demo scene (URP). I made everything from Documentation/User Guide, but didn't see any effect. Could you help me? I'm using Unity 2019.4.14f, URP 7.3.1
     
  18. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    My guess is that you forgot to crank up HBAO intensity setting to 1.
     
  19. NestorVG

    NestorVG

    Joined:
    Feb 12, 2019
    Posts:
    5
    Same issue, I am working on 2019.4.11 with 7.3.1 URP. I don't know what to do, I have tried it all, but the shader is not working. In the URP demo scene I try to view "HBAO only" and it doesn't change anything.
     
  20. NestorVG

    NestorVG

    Joined:
    Feb 12, 2019
    Posts:
    5
    Anyone got it working on URP?
     
  21. msjoberg

    msjoberg

    Joined:
    Jan 31, 2018
    Posts:
    2
    There are some issues when using this shader in 2019.4.x URP and running with Camera.allowDynamicResolution & ScalableBufferManager.ResizeBuffers.

    Some black lines are flickering on the screen when this is enabled.

    Any chance that you can take a look at that ?
     
  22. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    @jimmikaelkael For HDRP 10.3.1, there is an injection point: Before TAA. If HBAO were applied here, would it solve the "appearing on fog" problem without having to modify the core HDRP files?
     
  23. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    Sadly, no...
    https://github.com/Unity-Technologies/Graphics/blob/991240675d36be1b600a8f7b63c0364e89b8ecbd/com.unity.render-pipelines.high-definition/Documentation~/Custom-Post-Process.md

    BeforeTAA injection point is not even mentionned in the diagram, but it happens in the PostProcess stage on the right.
    What we need is something that goes before "Sky & Fog" in "Opaque & Sky".
     
    Korindian likes this.
  24. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    Thanks for replying. Perhaps posting that in the HDRP forum could get some attention from the devs.

    By the way, this effect is much better than the built-in HDRP SSAO, with less artifacts, more options, and with potentially better performance depending on the settings. Well done.

    Also, in HDRP, in Forward rendering, if I enable MSAA, I get a gray screen with only HBAO showing, and the console errors:

    RTHandle.Initialize should only be called once before allocating any Render Texture. This may be caused by an unreleased RTHandle resource.
    Unreleased RTHandles:
    HBAO_AO
    HBAO_Temp
    HBAO_Temp2

    and

    A multisampled texture being bound to a non-multisampled sampler. Disabling in order to avoid undefined behavior. Please use Texture2DMS in the shader.
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)


    Is this a known issue?
     
  25. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    52
    any update about URP and single pass?
     
    GridWanderer likes this.
  26. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    For MSAA, once again this is Unity limitation... I'm really sorry:
    Capture.PNG
    Currently Unity does not feed custom post processes with valid MSAA color buffer.

    That said, get in touch with me by email (found on my publisher page) I can provide you with a HBAO version who handles it and show the slight modification required in HDRenderPipeline.cs Nope, my solution does not fully work.

    I was never able to get attention from the devs, in more than 5 years... Sadly.
     
    Last edited: Feb 14, 2021
    Korindian likes this.
  27. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    I'm really sorry for the inconvenience, my headset had a malfunction. I should be able to acquire one new soon.
     
    GridWanderer likes this.
  28. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    44
    @jimmikaelkael After upgrading from HBAO 3.3 to 3.3.1 I am also seeing this issue using the official FPS rendering setup from Unity. Any ideas?

    Versions:
    Unity 2020.2.4f1
    HBAO 3.3.1
    URP 10.3.1
     
  29. GoldFireStudios

    GoldFireStudios

    Joined:
    Nov 21, 2018
    Posts:
    102
    I'm having an issue where the AO shows for objects that are under the terrain when using camera per pixel normals. It works fine if I turn per pixel normals off, but obviously doesn't look quite as good. I'm using forward rendering and get the same result with the default terrain material as well. Any ideas what could be causing this?

     
  30. Howard-Day

    Howard-Day

    Joined:
    Oct 25, 2013
    Posts:
    133
    Howdy! As always, I love this asset, and I've used it on multiple projects. I was curious - is there any chance it could be integrated with the new unity post-processing stack? I ask mostly because it would make managing the various different settings easier to do, as well as helping keep all the post-stuff in the same place for revisions.
    Thanks!
     
  31. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    2
    Not working for URP, tested on 2019 and 2020.2
     
  32. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    59
    How to stop Unity from overwriting the core HDRP files? When I had 2019 I remodified them upon opening the editor, but now 2020 it overwrites them as soon as it compiles anything, rendering this method useless. Is there anyway to stop this automatic update?
     
  33. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    47
    So it's not working with Unity 2021 URP12 or Unity 2020.3.0f1 URP10.3.2/10.4.0
     
  34. pretender

    pretender

    Joined:
    Mar 6, 2010
    Posts:
    839
    hi guys, i am trying to add HBAO component at runtime on camera, but it doesn't work. Idea is to have it as asset bundle so the shaders are downloaded and applied. I wonder is this possible. currently i am add component at runtime and applying asset but it doesn't work like this:

    Code (CSharp):
    1. var hbao = cam.gameObject.AddComponent<HBAO>();
    2.             hbao.ApplyPreset(HBAO_Core.Preset.FastestPerformance);
    3.             hbao.enabled = false;
    4.             hbao.enabled = true;
     
  35. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    47
    Is there a thread in the graphics forum, just point us at it.. absolutely sick of Unity and the shoddy URP progress, it's been years and it's still a bug ridden mess that doesn't match built in render features. Half a dozen assets use it, still tempting to just go back to built in.
     
  36. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    420
    Unity 2020.3, URP 10.3.2, HBAO is broken:

    upload_2021-3-15_15-24-50.png
     
  37. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    59
    I tried embedding the package. HDrenderpipeline.cs now stays modified but doens't have any effect on rendering ambient occlussion before fog

    Update: I even tried just removing the douserafteropaqueandtransparency from the embedded package's hdrenderpipeline.cs and its still doing it. Are embedded packages not "real" or somethin?
     
    Last edited: Mar 20, 2021
  38. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    420
    Still awaiting an HBAO update for 2020.3
    Is this in the works?
     
  39. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    47
    I dunno, I think the developer is just pissed off with Unity developers for making URP such a trainwreck.
     
  40. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    HBAO 3.3.1 works fine with Unity 2019, 2020 and 2021. Also, works fine with URP 10.3.2 up to 11 included (latest verified).
    If you have problems, delete your package entirely and update/reimport, then carefully follow installation steps detailed in the manual.

    I'm sorry for such incovenience... Please people, help me drawing attention from the devs for this issue: https://forum.unity.com/threads/mis...nt-in-hd-render-pipeline.979803/#post-6364893

    Never tried it but it should work. Are you sure HBAO shaders are included in the bundle?

    Yep, HBAO relies on normals buffer while in camera normals mode, obviously Unity terrain is doing something wrong. I'm really sorry about it.

    This is not the first time this is being requested, so I think I will try to port it on PPS but just to be clear: you won't see any performance gain, this will just be for convenience.
     
    GridWanderer likes this.
  41. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    47
    Is URP12 support coming?
     
  42. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    Yes if required, once the package is verified.
     
  43. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    47
    would be good to have it yes
     
  44. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    47
    Wasn't working on URP12 Unity2021 because of the below error and I was checking the Demo not the URP demo... so it does work

    "Assets\Horizon Based Ambient Occlusion\SRP\URP\Editor\HBAOEditor.cs(34,30): error CS0115: 'HBAOEditor.hasAdvancedMode': no suitable method found to override" ...commenting it out seems fine until a package update comes?
     
    jimmikaelkael likes this.
  45. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    Field is not being tagged as anything as of URP 11.0.0, good job Unity!
    Proper fix is to rename field to 'hasAdditionalProperties'.

    I'll wait a bit before publishing a fix, because who knows if they won't change name again before shipping the package...
     
    Slashbot64 likes this.
  46. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    189
    Hi!

    First of all - love the asset. We have been using it for a long time now and it has always been our go to solution for AO!
    Great to see it work properly in URP as well and it is still a huge improvement on anything Unity provides.

    I have no real issues but I am wondering if you can give us some details on expected performance loss/gain when using the depthNormals (per pixel normals -> camera - setting).

    I am tracking down some severe performance drops after we switched from 2019.4 to 2020.3 in URP WebGL.

    I understand using the depthNormal pass should/could be more performance intensive but I was wondering if you had any general details on this. Currently I can track down a performance drop of around 15% when using the dephtNormals instead of reconstruct 4x.

    We're more than happy to use reconstruct for perfomance reasons - visually it looks fine, but I was just wondering what we should/could expect.

    -Pieter
     
  47. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    I don't really know what to tell you about this. This is beyond my control...

    You already know about it: since HBAO requests DepthNormals pass instead of DepthOnly when using "Camera" as per pixel normals yeah Unity has more to do.
    I can't really judge however for performances I mean if the drop you get is normal or not as this is scene dependent. The more objects in the frustum, heavier is the cost of DepthNormals pass (and same goes for DepthOnly pass ofc).
     
  48. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    189
    Thanks for the reply. I kinda figured already but was wondering if anything out of the ordinary popped up on Unity's end when depthNormals became available. At the moment I can pretty much confirm our severe performance drop has nothing to do with either depthnormals or the asset. Which I suspected, but since this is Unity LTS I gotta check everything twice and sometimes three times ;)

    Thanks again for your reply and time.

    -Pieter
     
  49. Calum

    Calum

    Joined:
    Mar 14, 2015
    Posts:
    45
    Hi there,

    Just purchased the asset and I'm trying to use in Unity 2020.3.2f1 and URP 10.4.0. I have tried to follow the instructions but I get no effect in scene or play mode.

    I think it's got something to do with the fact that when I try to add hbao to renderer features it adds a name only, there's no settings like in the picture in the docs.
     

    Attached Files:

  50. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    651
    The settings aren't exposed here, it is volume driven:
    - add the effect to your volume profile and override intensity to a value of 1 for normal effect.
     
unityunity