Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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:
    603
    You need to use HBAO_Integrated component, not the obsolete HBAO one.
     
    ChinChiaYeh likes this.
  2. imagoculturae

    imagoculturae

    Joined:
    Apr 8, 2014
    Posts:
    81
    Does it work with HDRP ? The demo seams not work in this mode
     
  3. wzxy1322

    wzxy1322

    Joined:
    Jul 3, 2018
    Posts:
    3
    Hello, I have a warning Assets\Horizon Based Ambient Occlusion\Scripts\Editor\HBAO_Core_Editor.cs(157,29): warning CS0618: 'PlayerSettings.virtualRealitySupported' is obsolete: 'This API is obsolete, and should no longer be used. Please use XRManagerSettings in the XR Management package instead.' I hope it can be solved, thank you!
     
  4. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    This is not supported yet, I'm sorry.
     
  5. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Sure, send me a support request in PM with your invoice number.
     
  6. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    On Unity v2018.4.1f1, Oculus Utilities v1.43.0, OVRPlugin v1.43.0, SDK v1.44.0, HBAO 2.7.1.

    VR Single pass, building to an Android apk for Quest. (OpenGLES3 graphics API)

    I get 8 errors when I try to build the project, which makes the build process fail:


    @jimmikaelkael tells me that
    "sampler_CameraDepthTexture" is normally defined by Unity, any SSAO effect require it to access depth buffer.
    It's either Unity fault either the platform you build for doesn't support rendering depth texture.
    I'm sorry, nothing I can do...

    Does anyone have any idea what the problem might be and how to solve it? Has anyone used HBAO on a Quest build?

    Thanks
     
  7. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Something worth to be tried:
    - open HBAO.shader file, change line 36 to be UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); and please report what happens after this change.
     
  8. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    Thanks @jimmikaelkael Your prompt replies and emails are very much appreciated.

    So I'm guessing you meant change line 38?
    sampler2D_float _CameraDepthTexture;
    ? (Changing 36 breaks everything)

    That got rid of the previous errors, but introduces a new one:

    Code (CSharp):
    1. Shader error in 'Hidden/HBAO': undeclared identifier 'sampler_DepthTex' at Assets/Horizon Based Ambient Occlusion/Shaders/HBAO_frag.cginc(54) (on gles3)
    2.  
    3. Compiling Vertex program with STEREO_MULTIVIEW_ON OFFSCREEN_SAMPLES_CONTRIB
    4. Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_LIGHTMAP_DLDR_ENCODING
    In your last email, you mentioned "maybe your targeted platform doesn't support rendering depth buffer (have you checked that ?)"

    It's unclear what you mean by targeted platform. It's Android 5.0 'Lollipop' (API Level 21). What other platform settings would you need to know about?
    Also, can you explain how I would check if rendering the depth buffer is supported? Isn't it always?
     
  9. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Yep that was a typo, you got it.

    It should be in your case, I checked it. And that's why I investigated further...

    So please try to change both line 38, and 43:
    sampler2D_float _CameraDepthTexture; -> UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
    sampler2D_float _DepthTex; -> UNITY_DECLARE_DEPTH_TEXTURE(_DepthTex);

    Waiting for your feedback.
     
  10. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Just to let you know, to let people know, my wife passed away on 3rd november 2019 after living 20 years together and children. I've hold her until the end and she died in my arms, really hard moment for me...
     
  11. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    yay, that builds with no errors, but sadly no AO. On the Quest I'm getting just triangles rendered to each eye:



    Works fine in Editor (on PC)
     
  12. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    So very sorry to hear your sad news. Ignore my posts - you shouldn't be working at a time like this, and I certainly don't expect any support when you have other far more important things on your mind. Take all the time you need.
     
  13. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Are you using the newer HBAO_Integrated component ? you should, just to make sure.
    Also, what happens if you disable Single Pass, does it work ?

    EDIT: and deinterleaving mode isn't supported in Single Pass disable this too if enabled.
     
    Last edited: Jan 7, 2020
  14. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    Yes, using HBAO_Integrated.

    Multipass works (though it tanks my framerate ;) )

    Now take time off. Wishing you all the very best at this difficult time.
     
  15. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    I see now it's depth not being sampled correctly. I'd like to do another test, I'll send you a couple modified files in email.
     
  16. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    Thank you. I'm happy to help debug
     
  17. Karan90

    Karan90

    Joined:
    Mar 19, 2019
    Posts:
    13
    Hello. Does this work in Oculus Quest?
     
  18. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    @Karan90 See my posts above. Quest currently only works if you disable Single Pass. It works fine for normal PC VR but once you switch platform to Android (and build) you get the screenshot I posted.

    @jimmikaelkael has been super helpful offline with debugging, and is working on a solution (although he's currently dealing with a bit of a life crisis so I think it's only polite to be patient)
     
  19. Karan90

    Karan90

    Joined:
    Mar 19, 2019
    Posts:
    13
  20. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    207
    Any ETA yet? :) No pressure, but we love HBAO and would love to use it in HDRP enabled project as well.
     
  21. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    228
    I was interested in using this in an upcoming patch to a PS4 game but it doesn't do anything on the PS4. Is this a known issue? I'm testing with the trial package and both HBAO & HBAO Integrated both failed to do anything on the PS4 although they work fine on the PC side. The trial package also generates an error "MissingMethodException: Method not found: 'UnityEngine.Texture2D.LoadImage'" on the PC side so I don't know if this is related. I'm using 2017.4.29f1.
     
  22. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    64
    Hi, I've tried attaching the Integrated and default version of the component to my main camera in the first slot and am seeing nothing in 2019.3 - even playing with the Display Mode does nothing in the editor view. Default preset is applied, and I've played with all the sliders. Am I missing something?
     
  23. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Yep, it works in 2019.3.
     
  24. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    HBAO v2.8 has been submitted for review, changelog is the following:
    • Added URP support 7.1.8+ (Unity 2019.3+)

    Now doing HDRP support which should be ready in the next few days. After that I'll fix Single Pass issues.
     
    Last edited: Feb 29, 2020
    osss, Cascho01, transat and 1 other person like this.
  25. bartek0403

    bartek0403

    Joined:
    Mar 20, 2018
    Posts:
    7
    Hi, I'm using HBAO v2.8 in VR project with URP 7.2.1. I encountered some issues regarding VR camera output. When I'm using Multi Pass I get right eye black, Single pass divides each eye into two images. Attached screenshot should describe it better. Am I missing something or is it known issue? In my pipeline feature there are no other postprocess components
     

    Attached Files:

  26. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Yes I'm not surprised, VR fixes are on the todo list but you'll have to wait a few weeks. Sorry for the inconvenience...
     
  27. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    @jimmikaelkael thanks so much for URP support! You’re a legend. Yours is the only professional AO on the market for URP.
     
  28. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Thank you :) but don't rush there's actually a downside: URP actually doesn't generate view normals so the hbao is running exclusively in reconstruct per pixel normals mode, which has a perf cost of course. Once they add view normals I'll re-activate camera view normals mode in HBAO for URP.
     
  29. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    Performance seems perfectly fine for me for now but looking forward to improvements down the track when Unity gets their act together.
     
    jimmikaelkael likes this.
  30. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    104
    The URP version of the effect is not working on builds. Everything goes black. Works fine in editor. Does it happen to somebody else?

    I'm using 2019.3 with URP 7.1.8.
     
  31. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Works fine here, please check player log.
     
  32. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    @xDavidLeon I found a problem with Color Bleeding enabled in builds leading to black screen, it will be fixed soon.
     
  33. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    104
    I just created an empty URP project and added the plugin. If you enable Color Bleeding, everything is black in build. Disabling color bleeding makes it work fine. It should be easy enough to reproduce, but if you are not able to reproduce the issue I can share a project on Monday.
     
  34. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Yes, as I said above I have been able to reproduce and fix it. This is a shader keywords problem, an update will be available soon.
     
  35. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    104
    Sorry! I hadn't read your last message. Thank you for the quick replies and support :)
     
  36. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    106
    Is there possibility for trial version of your plugin which supports URP?
    Maybe with watermark or something?
    There is so many things not compatible with URP / Newest Unity that my life's "trust" parameter went to the bottom.
     
  37. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    You will have to live with it... HBAO is the same in URP than in Standard pipeline.
    Why would I lie ?
    This is deliberate that the demo lag behind releases because a trial is the best way to leak the asset.
     
  38. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    106
    I not mean that you lie, I am sure it's all working when you test it, but lately I encountered so many issues some stuff is working ok on some people machines and on some not.
    Thanks, I will check it with trial on standard rp then.
     
  39. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Version 2.9 is pending review:
    • Fixed URP version shader keywords problem resulting in blackscreen in builds
    • Fixed URP support on OpenGLES2 graphic API
    • Fixed PS4 compilation error
    • Fixed orthographic camera support on OpenGL, OpenGLES2 and OpenGLES3 graphic APIs
    • Fixed AO consistency on various resolutions (render scale, dynamic resolution)
    • Fixed incorrect view normals sampling at half resolution
    • Allowed use of local shader keywords instead of global keywords
    • Removed obsolete random noise, downsampled blur and quarter AO resolution
     
  40. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    626
    Bought it today for URP and demo-scene does not seem to work. At least nothing happens at all when checking boxes/moving slider.

    Also have no clue how to set it up, docs seem quite complicated, just a simple step-by-step implementation with some images would be awesome.
     
  41. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Open the PDF documentation, on page 2 you have a table of content with links, just click to Universal Render Pipeline section... then you will have step by step screenshots of what's needed to do.
    Is that really hard ?
     
  42. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    626
    Zzz I looked at the readme, my bad, Ill give this a try!
     
  43. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    626
    That worked :)

    If you end up w a white screen Change Display mode
     

    Attached Files:

  44. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    The upcoming 2.9 update will solve a few problems in URP.
     
  45. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    104
    upload_2020-3-17_10-43-53.png

    I'm using a tool that reports all shader keywords used. HBAO seems to spam thousands of lines of shader keywords using a Shader Keyword reporting tool.
     
    Last edited: Mar 17, 2020
  46. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    104
    Also noticed some strong color banding when enabling color bleeding.

    upload_2020-3-17_11-6-34.png
     
  47. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    HBAO shader has thousands of variants so that is expected, actually I'm fully rewriting both Standard and URP pipeline shader and scripts for cleaner and more efficient code and it will come with a bit less variants (You will still have 2.1K variants). Note that keywords being used are local shader keywords.
     
  48. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Yes, I used a wrong RenderTextureFormat for colorbleeding which introduces this problem, actually I'd say in 2.9 colorbleeding is not usable.

    HBAO v3.0 (will be compatible with 2019.1+) is coming really soon, and as I mentioned earlier this is a full rewrite. You will have scene view effect in Standard Pipeline, stackable AO component, temporal filter, less local keywords and shader variants (2.1K variants, the strict minimum for all offered features), fixed color bleeding and other good stuff.
     
    Last edited: Mar 17, 2020
    noio and transat like this.
  49. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    420
    When I'm close to object (a human face for example) it looks good but if I get just 1 meter distance from the model it loose intensity :eek:
     
  50. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    603
    Does your scene has correct scaling ?
     
unityunity