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:
    652
    HBAO does not rely on PPV2. It should work along with it.
     
    leslviv likes this.
  2. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Yes it can depend on your settings. Is your 3D objects scale correct ?
     
  3. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    670
    I understand ur not getting it on ur end but its not like im sitting here lying... Instead of trying to make it seem like its my fault maybe just try to help?

    Ill try to profile the GPU, you could have just suggested that instead of writing it like ur talking to an idiot. I might not know as much as you about this stuff.
     
  4. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Seriously ?
    Are you kidding me ?

    Are you expecting me to learn you how to profile ?
     
  5. Yavvn

    Yavvn

    Joined:
    May 8, 2019
    Posts:
    18
    It appears this asset is currently not compatible with MSAA enabled under URP.

    It creates a white outline around any contrasting pixels, mainly the borders of differently colored objects. I have Depth Textures enabled but as someone else said, it appears that MSAA is doing an earlier pass that messes with this HBAO.
     
  6. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    670
    Ofc not, thats not what I said, I said you could have suggested that I try it. Jesus man relax, its ur product. Plus there is little point in me profiling the issue when it goes away if I disable your product, nothing else fixes it. You havent once asked me to send you any material that might help you debug.

    Gotta say, this is the first time I've had a negative experience with an asset creator, ur asset is really cool but you are not very pleasant. I'll just move on.
     
    Last edited: Aug 29, 2020
  7. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Was that offending to you?
    I never meant to offend, I'm really sorry you took it like that...

    Am I saying that you're lying? no.
    Am I treating you like an idiot ? no.
    Am I giving you clues? yes.

    I haven't asked because I know you are GPU bound, that's all. HBAO has a cost on GPU, and in your case enabling HBAO consume more GPU time and then CPU is awaiting GPU to finish.

    Well, no offense taken.
     
  8. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    774
    @jimmikaelkael Have you had a look at the depth pass available in URP 10 yet? I remember you had mentioned you could get a speed boost when that was ready. Unity’s new AO is quite disappointing, btw.
     
  9. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,664
    Has anyone used this on mobile yet? How is the performance?

    And does it work on WebGL?
     
    Last edited: Sep 1, 2020
  10. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,380
    Can this give me similar results to something like a Ground Truth-based Ambient Occlusion? I would want to have a bigger range for big details and smaller range for the finest details, would be nice if it has good thickness two. I'm looking to achieve something close to this:

     
    Lars-Steenhoff likes this.
  11. CmartinezSaltoki

    CmartinezSaltoki

    Joined:
    May 21, 2020
    Posts:
    10
    Hi again!

    I'm writting this time because our console is showing +999 warnings. As far as I'm aware everything compiles correctly (I'm not the team programmer though), in fact, visually it seems to be working fine (we're getting the shadows we want).

    If anyone could help us out would be great!

    Thanks in advance.

    WARNING-HBAO.PNG
     
  12. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    287
    Hi,

    Is it possible to exclude this effect from certain objects or layers? For example, I would like to have this effect on my environment, but not on my characters.

    Thanks!
     
  13. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    25
    Hi,

    Sorry if I've missed it somewhere but how do I get this working with the PPv2 stack? I'm unable to find it in the overrides.
     
    Last edited: Sep 14, 2020
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    I will need to check it.

    I still do not recommend it on mobile. Standard pipeline version works fine on Standard and HDRP pipeline. In URP currently all post-processes are disabled on GLES by the pipeline code.

    No you won't get this. HBAO is not raytraced AO.

    It seems HBAO shader does not compile... You should select the HBAO.shader file and check what the inspector says.

    No, I'm sorry but this is not possible, HBAO is a screenspace image effect.

    In Standard pipeline, HBAO does not rely on PP stack to work, it is standalone. You need to attach the effect to your camera, I suggest you to read the documentation.
     
    florianalexandru05 likes this.
  15. CmartinezSaltoki

    CmartinezSaltoki

    Joined:
    May 21, 2020
    Posts:
    10
    We did what you suggested and the inspector doesn't say anything. It seems there are 2 different HBAO.shader... Is this suposed to be like that?

    Thanks again!
     
  16. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Hmmm, sometimes after updating asset it can happen... Try to delete the asset completely and reimport.
     
  17. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,768
    Hi this looks impressive, can it do better than the built-in AO in HDRP, which does this:?!

    ao.png
     
  18. McPeppergames

    McPeppergames

    Joined:
    Feb 15, 2019
    Posts:
    75
    I am trying to make it work with URP and when adding the HBAO to the Post-Process-Volume and hitting Apply Preset I can see a warning: "The effect is disabled by default, you need to override intensity value in order to enable HBAO."

    How can I do this?
     
  19. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    You need to expand HBAO settings in your post process volume, go to the intensity slider, enable it then adjust intensity slider to something like 1 or whatever you like.
     
  20. CmartinezSaltoki

    CmartinezSaltoki

    Joined:
    May 21, 2020
    Posts:
    10
    We deleted it and re imported and everything works fine now!

    Thank you!
     
  21. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    140
    We get the following message, if we enable VR (via XRLoader, e.g. the new VR system), Anti Aliasing, forward mode, Legancy Render Pipeline:
    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.
    Stereo Rendering mode is set to Multi Pass. If VR or antialiasing is disabled, HBAO works as expected. HBAO and antialisaing works without VR.

    Do you have an idea how to correct this?
     
  22. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    352
    Will there be any improvements for curved surfaces in URP?

    My main issue is my characters have sharp edges on round organic surfaces... It looks really weird.

    upload_2020-10-16_23-44-0.png

    upload_2020-10-16_23-45-4.png

    It comes up in all kinds of weird ways, i've mitigated this a bit with some settings, but it's quite disappointing.

    Mitigated settings
    upload_2020-10-16_23-46-50.png

    upload_2020-10-16_23-47-19.png
     
  23. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    175
    Hi, I'm not much of a coder, but I wondered if it's possible for me modify the shade color and make it HDR? I would also like to able to be able to set minimum distance in addition to maximum. The reason for this is that I want the shaded areas to glow at a distance from the camera.

    Also, how heavy would it be to use 2 AO scripts?
     
  24. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    I'm sorry you were disappointed...
    So, this is a current limitation of view normals computed from depth buffer when using low tesselated geometry. The bias slider can help you to mitigate this.

    However, in URP 10.0.0 (Unity 2020.2) the issue will be solved as Unity is introducing view normals, I have the fixes already, and I'm pushing an update today.
    Per pixel normals setting will have a new option: Camera, which is what you want.
     
  25. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Yep, hdr color and min disytance is possible. I don't recommend running 2 instances, will be twice the cost.
     
  26. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    HBAO v3.3.1 has been submitted for review, changelog:
    • Added support for upcoming URP 10.0.0 (support view normals)

    Sorry to be so late about this issue, will investigate it and fix for the next release.
     
  27. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    175
    Sorry to bother you, but like I said I'm not much of a coder. Could you point to me where in your files I could find these things please? I think I should be able to manage the rest myself.:oops:
     
  28. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Well, I'm sorry but I completely have overlooked the "I'm not a coder" statement.
    Unfortunately this is not a single line change, you will need to modify runtime and editor script, but HBAO shader as well.

    Let me add this to the next release todo list, does it suit you ?
     
  29. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    175
    Yes that would be awesome. Sorry to be a bother. Thank you.
     
  30. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    140
    Thank you for your support! We are using the legency build in renderer, no URP. The screen looks also only gray, e.g. only the AO is visible when VR is enabled. We checked for multi/single instance rendering on the camera, both did not work. Do you think that the above fix, will also fix our issues?
     
  31. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    Sadly, no... The above fix is for fixing a bug in URP 10 and also use introduced view normals, it won't fix your problem.
    Thank you for the details about the issue.
     
  32. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    140
    Do you have an idea why this happens, do you have the same issue with VR?
     
  33. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    No I don't have the same issue, last time I checked at least.
    This error reminds me something yeah, I think my conditional checks in HBAO.cs aren't detecting you are doing single pass instancing.
     
  34. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    140
    Okay, I'll check and come back here if I find something. Thank you for the Tipp.
     
  35. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    352
    Hm i see, fair enough then, hopefully moving to Unity 2020 will be fairly painless in the future.

    Also another question, if I wanted to change the SSAO quality by code what would i need to do to acess the volume? I'm still learning URP stuff and it seems different than what I originally did in standard pipeline.
     
  36. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    You can take a look at "Horizon Based Ambient Occlusion/SRP/URP/Demo/Runtime/HBAOControl.cs" script for an example.

    You need to get a reference to your VolumeProfile, then you can for example do:
    Code (csharp):
    1.  
    2. HBAO hbao;
    3. volumeProfile.TryGet(out hbao);
    4.  
    5. if (hbao != null)
    6. {
    7.     hbao.EnableHBAO(true);   // enable/disable HBAO
    8.     hbao.SetAoRadius(1.2f);  // change radius
    9.     hbao.SetIntensity(0.8f); // change intensity
    10.     ...
    11.     hbao.SetQuality(HBAO.Quality.Low); // change quality
    12.     ...
    13.     hbao.ApplyPreset(HBAO.Preset.FastPerformance); // or apply a preset
    14. }
    15.  
    Don't hesitate to take a look at "Horizon Based Ambient Occlusion/SRP/URP/Runtime/HBAO.cs" script to see what's exposed, there's are a lot of methods available to control HBAO easily.
     
  37. Sibylline-Siren

    Sibylline-Siren

    Joined:
    Jul 8, 2012
    Posts:
    21
    Updated Unity and URP and the HBAO package and it stopped working :(

    Code (CSharp):
    1. You can only call cameraColorTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed.
    2. UnityEngine.Rendering.Universal.ScriptableRenderer:get_cameraColorTarget ()
    3.  
    4. HBAORendererFeature/HBAORenderPass:Setup (UnityEngine.Shader,UnityEngine.Rendering.Universal.ScriptableRenderer,UnityEngine.Rendering.Universal.RenderingData) (at Assets/Horizon Based Ambient Occlusion/SRP/URP/Runtime/HBAORendererFeature.cs:433)
    5.  
    6. HBAORendererFeature:AddRenderPasses (UnityEngine.Rendering.Universal.ScriptableRenderer,UnityEngine.Rendering.Universal.RenderingData&) (at Assets/Horizon Based Ambient Occlusion/SRP/URP/Runtime/HBAORendererFeature.cs:917)
    7. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    It's further commented here (nothing to do with the asset): https://forum.unity.com/threads/custom-renderer-features-broken-on-10-0-0-preview-26.980541/
     
  38. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    I'm sorry it's actually quite unclear that just update HBAO asset is not sufficient. URP version of HBAO being embedded as a unity package inside the asset, you also need to unpack URP.unitypackage again after you proceeded to package update.
    HBAO will work correctly after that, sorry for the lack of informations.
     
  39. Sibylline-Siren

    Sibylline-Siren

    Joined:
    Jul 8, 2012
    Posts:
    21
    Ah, seems so obvious now, I should have known better. That totally worked.
    Thanks a lot.
     
    Last edited: Nov 11, 2020
  40. unity_OwsoyU3laIykcQ

    unity_OwsoyU3laIykcQ

    Joined:
    Dec 9, 2019
    Posts:
    1
    In VR single pass render mode under URP, the screen is doubled if we increase the AO intensity above 0.


    upload_2020-11-17_11-50-36.png
     
  41. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    I'm really sorry for the inconvenience, actually HBAO has no support for VR in Universal Render Pipeline.
    It will be supported end 2020.
     
    GridWanderer likes this.
  42. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    667
    Hi I saw your comment and wanted to say if you are using Windows 7 there is a major issue where having Aero disabled causes massive performance drops and also the GFX wait for present issue. I recommend that you enable Aero and see if it solves that issue also what GPU are you using because that Performance drop from 200 to 60 is of importance to me and if you are using a very old card it's understandable but I need to know.
     
  43. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    667
    I am considering purchasing this asset because I need an Accurate AO solution.
    1.How much better is this than the current built in HD Pipeline AO?
    2.One of the issues I have with the HD AO is on certain angles the AO is not accurate at all does this happen with HBAO?
    3.I don't think the HD Pipeline AO has Gbuffer support but I'm not sure does this properly utilize the GBuffer for better AO?
     
  44. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    652
    1. I'd say it is better, I don't like Unity's implementation of GTAO but I guess I'm biased anyway.
    2. I'm not sure what you're talking about. If that lack of accuracy comes from depth buffer or view normals, yeah HBAO might do the same... Hard to tell as I never have really compared the two.
    3. HD pipeline has it, HBAO uses it as well. The main benefit if that it comes with higher precision.
     
    SilverStorm likes this.
  45. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,768
    Trying this in HDRP but run into issues with 2020.1.12
    - *fixed with depth change* Firstly in deferred it draws a kind of smudged copy of the AO in the background where the camera-background-color is - (edit: bit less so if clear g-buffer, none if enable bounce at 1!?)
    - *Unity issues with MSAA/order* In forward it does not work? (not got it to)
    - *Possible unity bug in editor* If I switch volumes at runtime (say from one with HBAO to one without) or or toggle things I get an error in editor console:
    RTHandle.Initialize should only be called once before allocating any Render Texture. This may be caused by an unreleased RTHandle resource.
    UnityEngine.GUIUtilityrocessEvent(Int32, IntPtr, Boolean&)
     
    Last edited: Nov 24, 2020
  46. jacasch

    jacasch

    Joined:
    Jan 20, 2017
    Posts:
    14
    I just bought the asset, but I cant get it to work. In The Demo Scene there just is no ambient occlusion.
    Im using Untiy 2019.4 and URP 7.5.1
    I imported the Unitypackage in the SRP Folder.
    I also tried addingHBAO Render Feature to my pipeline, but there's also nothing happening.
    Am I missing something?

    Edit:
    It seems to be working now. I dont know What I changed, but yeah, looks really good so far
     
    Last edited: Nov 24, 2020
  47. tagabalon

    tagabalon

    Joined:
    Oct 12, 2012
    Posts:
    3
    Can you remember anything you did that made it work? Doesn't seem to work on mine, even the demo. Using Unity 2019.4 and URP 7.5.1 as well. Thanks.
     
  48. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,768
    Are you using forwards and MSAA? That is an issue in HDRP, maybe URP also
     
  49. polysoft3D

    polysoft3D

    Joined:
    Aug 3, 2015
    Posts:
    26
    Hello. What about Unity's URP beta SSAO ? What about performance ? Difference
     
  50. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    667
    The HBAO quality and accuracy is a lot better than any other asset even the HDRP one. However it's more expensive unless you run it on lowest which performs the same as the SSAO in Unity.
    But even on the lowest settings the AO looks amazing and I run a screen larger than HD so it's all good. Also when enabling multi bounce you get a kind of fake GI which is awesome!

    Here you can see the difference in AO of both with the first being HBAO with multi bounce and the second being HDRP built in AO. You can clearly see that the HDRP one is missing the outer edges completely and it just doesn't look right. Unity doesn't have performant real time GI anymore so I use HBAO along with some exposure settings to simulate full fake GI and it looks awesome no need for other effects. Look at the first images circle and the right wall edge they glow white which is sexy!
    HBAO New.png HDRP ultimate.png HBAO New.jpg
     
    Last edited: Nov 27, 2020
    jimmikaelkael and camta005 like this.
unityunity