Search Unity

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:
    796
    Generally I do not support patch versions as they are usually broken, that said your problem may exists as well on 5.5.0f3. I'm contacting you in PM.
     
  2. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi. @jimmikaelkael

    I have background camera which renders skydome and some others before the main camera rendering.
    But when I add HBAO to the main camera (which is set to be rendered after the background camera) it just shows black.
    I have set the main camera to not clear anything since clearing the framebuffer is being done by the background camera.

    How can I fix this issue?
     
  3. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Hi, this is quite common user error with this kind of dual camera setup.
    Could you please send me a small repro scene, so that I can send it back to you fixed ?
     
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I have sent you link to by message
     
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Also what is the best practice to work HBAO in orthographic camera? It seems like it is very sensitive to the camera far clipping distance in perspective camera, but not sure what is going on with orthographic camera.
     
  6. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    If you are on Unity 5.5, HBAO with othographic camera is broken. I have the fix already.
    Are you on Unity 5.5 ?
     
  7. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yes, I am on Unity 5.5
     
  8. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Ok, I'll sent you the fixed package along with the solution to your cam setup problem. Please look at conversations, Seems I can't access the file you're trying to share with me.
     
  9. Fatalis

    Fatalis

    Joined:
    Sep 9, 2013
    Posts:
    52
    Greetings @jimmikaelkael

    I'm having a problem with flickering in my project when HBAO is turned on, any thoughts on this?

    Unity 5.5.0f3
    Linear/Deferred
    DirectX 11
     
  10. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Hard to tell just like that :)

    Flickering on what ? whole screen ? on some objects ?

    Have you tested the "Reconstruct" as the per pixel normal setting ? I'm not suggesting you to switch to this forever but just as a matter of test, to see if the flickering disappear with this setting or not.
     
  11. Martyn96

    Martyn96

    Joined:
    Apr 8, 2016
    Posts:
    5
    Could I get the fixed package too, or will the asset get an update soon? Great asset btw!
     
  12. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Well, to clarify: this never has been a problem with HBAO... I provided a solution as a support to my customers, but this is a problem in dual camera setup and defintely not in HBAO package so there's no update required.

    - Which problem are you getting with the dual cam setup ?
    - Which Unity version are you using ?
    - Are you using the CopyToScreenRT.cs script on your lower depth camera ?
     
  13. Martyn96

    Martyn96

    Joined:
    Apr 8, 2016
    Posts:
    5
    Oh I'm sorry for the confusion but I meant HBAO with an orthographic camera in Unity 5.5 which isn't working for me currently.
     
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    My bad, sure I can provide you with the update! I'm contacting you in PM.
     
  15. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,021
    Just writing in to let you know absolutely loving this asset. Really bringing that extra dimension to my vertex painted characters. Thanks @jimmikaelkael.

    Anyone on the fence about buying this asset I can totally recommend it. My game characters are vertex painted and using 1 material in blender and I'm using the vertex shader that came with Probuilder(that works really well). I tried the new post process beta in unity 5.5 but the characters became translucent. This was one of the few AO systems that worked in my tests using the trial version and the new beta 2 version. Looks great with fantastic support.
     
  16. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Thank you very much for your kind words @docsavage. You really made my day! ;)
     
    docsavage likes this.
  17. Fatalis

    Fatalis

    Joined:
    Sep 9, 2013
    Posts:
    52
    Sorry I should have been more specific. The flickering looks like HBAO is turning on and off rapidly across the whole scene. Setting it to reconstruct does fix this.
     
  18. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I'd say it's a problem with things conflicting in your post fx chain, but not sure... Have you tried setting another Per Pixel Normal setting (Reconstruct mode excluded, of course) ?
     
  19. orrbain

    orrbain

    Joined:
    Aug 12, 2015
    Posts:
    20
    Just stopping by with another 'vote' for support for Single Pass Stereo. If there are any beta or alpha versions of it you'd like tested just holler.
     
  20. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Sorry for the late reply...
    Yes I'll do my best to add support for SPSR asap.
     
  21. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    Here's a scene with emission on the yellow objects set to 2. All surfaces are non-specular.

    HBAO is set to the normal preset with Color Bleeding enabled.

    On the right wall, is it supposed to look like that?

    upload_2017-2-6_12-30-39.png
    Unity 5.5.0p4, Deferred Rendering, Linear Color

    My second question is related to the color bleeding in the Cornell box on the first and second page.



    Isn't it strange that with color bleeding, the boxes become lighter near the floor? Also look at the back of the ceiling. I think the multiplication of albedo with bounce color is maybe not the best algorithm to simulate color bleeding.
     
  22. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Well, sure that the effect with your scene does look strange...The color bleeding implementation in HBAO is just a bonus, it samples in the same places where AO samples are collected, otherwise the perf cost would be another full post effect hit.

    This isn't optimal, it is true, but keep in mind this isn't a real color bleeding implementation on its own. Testing it with plain colors is just a bit crude, I've never designed the effect to work this way but rather with fine texture details.

    Doing a real color bleeding effect would require doing point clouds sampling, not just what HBAO does.

    In the cornell box I exagerated the albedo multiplier.
     
  23. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    Only for Outdoor scenes or also for Indoor?
     
  24. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    As most SSAO solutions it can suit both indoor and outdoor scene. Being a screen space image effect the perf cost is directly related to the resolution used and not to geometry complexity.
     
    Neo-Gamefactory likes this.
  25. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    Okay, because of the name "Horizon Based ..." ;)
    Last Question, is it in runtime or is it baked like the most assets?
    (i'm a shader and camera effect noob)
     
  26. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    AO is calculated every frame at runtime, every SSAO solution available on the store is working this way. If you're looking for baked AO you should look into scene lighting settings or another asset :)
     
  27. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    No, i looked for realtime :)
    So i like your asset and your pictures more than the others. i will buy it :) thank you ;)
     
  28. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    There is a free trial available, try it ;)
     
    Last edited: Feb 7, 2017
    Neo-Gamefactory likes this.
  29. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
    Amazing :) i like it.
     
  30. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    145
  31. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Just have submitted HBAO v2.0 for review with the following changelog:
    • Added a rendering pipeline integrated HBAO component (HBAO_Integrated.cs)
    • Fixed orthographic camera support in Unity 5.5+
    This image effect now comes with 2 variants: HBAO and HBAO_Integrated.
    HBAO is the normal post FX way, HBAO_Integrated as its name implies is
    integrated into the rendering pipeline with command buffers. Integrated mode
    should overall be less prone to problems with forward rendered shaders and allows PBR
    lit AO with "Before Reflections" integration stage.
     
    docsavage, jdraper3 and turboscalpeur like this.
  32. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    I'm sure you already doing your best, but I'm also here to drop another vote for SPSR for VR
     
    jimmikaelkael likes this.
  33. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    There still a problem with orthographic camera when using Deinterleaving: AO does not render, so just have submitted HBAO v2.1 with the following changelog:
    • Fixed orthographic camera support with Deinterleaving in Unity 5.5+
     
  34. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    This is on the roadmap for v2.2!
     
  35. RV1

    RV1

    Joined:
    Nov 18, 2012
    Posts:
    68
    Hi,

    I have an unusual issue with HBAO. It might only be a workflow issue, but I haven't checked to see if it occurs in a standalone build.

    Essentially certain events that occur in editor such as resizing the game viewport seems to break HBAO and as a result all non-transparent geometry turns black. I think the issue started happening in Unity 5.4 and onwards. I've been trying to debug whats causing this to happen, but so far I haven't found much. I have used the frame debugger to inspect what happens before and after I resize the viewport. After resizing, the passes marked #2, #18 and #22 all turn solid fill blue.

    I have tested resizing the viewport in the HBAO demo scene and this issue doesn't manifest. Any ideas what might be causing this?
     
  36. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Not really sure, but since it doesn't happen with the demo, something special with your camera setup ?
    Or a conflict between 2 post FX ?
     
  37. RV1

    RV1

    Joined:
    Nov 18, 2012
    Posts:
    68
    You will be pleased to know I finally managed to track down the cause. I had a piece of old code that was needlessly setting the projectionMatrix on the camera used by HBAO. The issue manifested when the viewport size was changed because the code would recompute and assign a new projection matrix when the screen width or height changed. Although this only affected HBAO (for some reason) and nothing else, I believe this to be a bug with my code and not HBAO.
     
  38. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Is there a way to change the intensity of the HBAO during runtime by code? I've tried a few things, currently my best bet would be;

    Code (JavaScript):
    1. GetComponent(HBAO_Core).ShaderProperties.intensity = 1;
    But that doesn't update the setting.
     
  39. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I suggest you to get a reference directly to the HBAO component you're using (HBAO or HBAO_Integrated):
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class NewBehaviourScript : MonoBehaviour {
    7.  
    8.    private HBAO m_hbao;
    9.  
    10.    void Start () {
    11.         m_hbao = GetComponent<HBAO>();
    12.         HBAO.AOSettings aoSettings = m_hbao.aoSettings;
    13.         aoSettings.intensity = 0.1f;
    14.         m_hbao.aoSettings = aoSettings;
    15.     }
    16. }
    17.  
     
  40. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I've put a 40% Off limited time offer on HBAO for march. Just need to wait it is approved.
     
    Stormy102, turboscalpeur and GamerPET like this.
  41. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Thanks for the support, that worked perfectly!
     
  42. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    You're welcome ;)
     
  43. pragmascript

    pragmascript

    Joined:
    Dec 31, 2010
    Posts:
    107
    Hello :) I have a weird issue regarding HBAO in our poststack:

    when we enable HBAO it seems to kill all colors > 1.0f and thus our bloom no longer works.
    This is independent of the position of HBAO in the post stack. So it kills the bloom if its in front of it in the post stack or after, order doesn't matter (which seems weird).

    Any ideas what could cause it or how to work around?
     
  44. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I'll check this.
    Have you tried with the integrated version of the hbao to see if it's the same ? (HBAO_Integrated component, for this one order in the stack have no effect)

    If you used the integrated component, have you tried the non integrated one ?

    Any error in the console ?
    Any error in the inspector when you select HBAO.shader ?
     
  45. pragmascript

    pragmascript

    Joined:
    Dec 31, 2010
    Posts:
    107
    Thank you for the quick response. Actually using HBAO_Integrated fixed it. :)
    (I didn't get console errors or shader errors)
     
  46. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Thank you for the feedback, I'll check the non-integrated component to see how the final pass is composited.

    If you're using deferred rendering the integrated component is definitely the best to use. If you select "Before Reflections" as integration stage in general settings you'll get PBR lit AO without any additional perf cost.
    If you don't want to get lit AO and you're using Deferred, then use "After Lighting" stage.
    If you're using Forward rendering use "Before Image Effect Opaque" as integration stage.
     
  47. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @pragmascript I was not able to reproduce the problem you had with bloom. Can I know which bloom asset you're using ?
     
  48. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    How long is this going to be on until? Might snap this up :)
     
  49. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Until the end of March ;)
     
    docsavage and Stormy102 like this.
  50. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    u 5.5.1

    Assets/Horizon Based Ambient Occlusion/Demo/Scripts/HBAOControl.cs(23,42): error CS1061: Type `Slider' does not contain a definition for `value' and no extension method `value' of type `Slider' could be found. Are you missing an assembly reference?

    imported fresh package in project