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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    584
  2. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    Picked this up at the weekend and it's great! One feature I'd like to request that I miss from SSAO Pro: the ability to change the base AO colour.

    My game has a stylised look and the ability to change the AO tint in SSAO Pro really helps seal my games look. This feature combined with the colour bleed in HBAO would make this the *perfect* AO package for me. Would it be possible to get this feature? I'm hoping it's a trivial addition to make :)
     
    jimmikaelkael likes this.
  3. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Glad you like it! ;)

    I should be able to provide you with 1.3.3beta tonight with the feature you are requesting.
     
  4. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    HBAO v1.3.3 has just been submited for review.

    Changelog:
    - Added AO base color setting
    - Fix leaked noise texture
    - Fix demo scene

    Many thanks to @JonDadley for suggesting an AO base color setting!
     
    JonDadley, Howard-Day and hopeful like this.
  5. MyGenericUsername

    MyGenericUsername

    Joined:
    Sep 6, 2014
    Posts:
    95
    Gonna have to buy this!! Looks really good!
     
    jimmikaelkael likes this.
  6. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    Looks like the v1.3.3 update is live! The AO Base Color setting works perfectly, thanks for implementing it so quickly!
     
    hopeful and jimmikaelkael like this.
  7. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Update 1.3.4 will be available soon (should be approved on upcoming week), it's contains a GX extension to integrate with Gaia.
    I'm sorry but I've delayed deferred HBAO a bit more since a few beta testers reported flickering with some Unity versions.
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,677
    Can color bleed be made brighter?
     
  9. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Can you please tell me a bit more ? Do you own the asset and want to make it brighter or are you asking if this have a setting to control color bleeding brightness ?

    EDIT: I'm pasting a screenshot of HBAO component as it may help people to figure out which settings they can have access to.

     
    Last edited: May 13, 2016
    laurentlavigne likes this.
  10. Howard-Day

    Howard-Day

    Joined:
    Oct 25, 2013
    Posts:
    124
    laurentlavigne: The setting you're looking for is Albedo Multiplier: That's what controls how much the color bleed is multiplied back into the scene.
     
    laurentlavigne and jimmikaelkael like this.
  11. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,677
    Thanks for the screenshot.
    What does albedo multiplier mean? Is color bleed multiplied or added to the image? I'd like a very GI look and it seems additive color bleed would do that.
    Is Radius the look up distance for color bleed? How does it work when the neighboring colors are out of screen?
    Could you show a Cornell box with this?
     
  12. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    The color bleeding is added to the image. The albedo multiplier controls how much albedo color is multiplied with bounce color from bleeding, but the final color is added.
    You can approximate GI with color bleeding, but this is certainly NOT a realtime GI replacement.

    The radius controls how far both AO and Color Bleeding are exploring the neighborhood. HBAO being a screenspace image effect (like every SSAO solution) it can only acquire informations from what is actually on screen.

     
    Last edited: May 14, 2016
  13. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,677
    Thanks for the Cornell Jimmi,
    The leftmost white box in original has red bleed, and the boxes have white bleed at the floor contact, seems that you turned static on and enlighten did its thing. Mind turning all static flag off, like in a dynamic environment and show us the difference? Also crank up the distance, want to see how much I could get away with faking GI.
     
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    I updated the above Cornell box picture, I had continuous baking checked on, sorry...

    Color bleeding with more distance:


    Now a scene with foliage (SpeedTree, and grasses are textures), no baked or precomputed GI.
    Original, forward rendering:


    AO and color bleeding, forward rendering:


    Color bleeding view, forward rendering:



    Original, deferred rendering:


    AO and color bleeding, deferred rendering:


    Color bleeding view, deferred rendering:


    Please note that these screenshots have been made with the next update which will be updated soon.
    Keep in mind that HBAO is not designed to fake GI...
     
    Last edited: May 17, 2016
  15. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Update 1.4 is pending review :)

    Changelog:
    • Added new user friendly UI & some presets
    • Fixed luminance influence not showing in AO only views
    • Fixed vanishing AO bug in while in editor
    This update will clear your previous settings, so if you already fine tuned the effect please make a note of your settings!

     
    punk likes this.
  16. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    1,533
    Just wondering if this will work on mobile ( Android/iOS )?

    I'm not overly concerned with performance as I generally have static scenes, but dynamically created by users. However I will need to to be able to tweak the source in order to generate a AO texture that can be reused across frames unless the viewpoint changes. At which point i'll disable SSAO until the camera stops moving then re-enable it, grab the overlay Texture and then re-use it.

    So more importantly to me is if this will work on mobile without graphical defects. I tried SSAO Pro on my nexus 7 and ( no disrespect to SSAO Pro as it doesn't claim to support mobile) it had horrible graphical glitches across the whole screen. It may be fixable, but if I can find an already working high quality SSAO solution i'd rather go with that.
     
  17. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Well I didn't get any chance yet to try it on mobile... Theoretically it should work.
    I'll try to test it on mobile on report.
     
    Noisecrime likes this.
  18. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    387
    Great new look ;)
     
    jimmikaelkael likes this.
  19. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    576
    Hi, Great Effect man, I'm wondering if you can help me. I'm trying to set in code so I can change settings during runtime, I tried the following code but says about storing some value.

    hbao is set to reference HBAO script.
    Code (CSharp):
    1. public void bSetHBAOQuality ()
    2.         {
    3.             switch (Mathf.RoundToInt (HBAOQualitySlider.value)) {
    4.             case 0:
    5.                 hbao.presets.preset = HBAO.Preset.FastestPerformance;
    6.                 HBAOQualityText.text = ("Fastest Performance");
    7.                 PlayButtonFx (buttonClickFx, buttonFxVol);
    8.                 break;
    9.             case 1:
    10.                 hbao.presets.preset = HBAO.Preset.FastPerformance;
    11.                 HBAOQualityText.text = ("Fast Performance");
    12.                 PlayButtonFx (buttonClickFx, buttonFxVol);
    13.                 break;
    14.             case 2:
    15.                 hbao.presets.preset = HBAO.Preset.Normal;
    16.                 HBAOQualityText.text = ("Normal");
    17.                 PlayButtonFx (buttonClickFx, buttonFxVol);
    18.                 break;
    19.             case 3:
    20.                 hbao.presets.preset = HBAO.Preset.HighQuality;
    21.                 HBAOQualityText.text = ("High Quality");
    22.                 PlayButtonFx (buttonClickFx, buttonFxVol);
    23.                 break;
    24.             case 4:
    25.                 hbao.presets.preset = HBAO.Preset.HighestQuality;
    26.                 HBAOQualityText.text = ("Highest Quality");
    27.                 PlayButtonFx (buttonClickFx, buttonFxVol);
    28.                 break;
    29.             }
    30.         }
     
  20. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Hey, glad you like the product :)

    Well to apply a preset there's a public method:
    Code (CSharp):
    1.  
    2. hbao.ApplyPreset(HBAO.Preset.FastestPerformance);
    3.  
    Then it should work as you expect ;)
     
    protopop and llJIMBOBll like this.
  21. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    576
    Perfect Thank you :D
     
  22. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    You're welcome ;)
     
  23. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    566
    Hi there, it's really very easy to showcase the tool, no Webplayer needed at all, just post a really well put Video showcasing the tool. I have tested all the AO tools in the store and none of them provide good enough results.

    Amplify Occlusion is really good however - but it costs A LOT of performance. You can download it here - they have a Try before you buy version so you can make some good comparisons.

    https://www.assetstore.unity3d.com/en/#!/content/56739

    I have heard good things about Horizon Based AO so I look forward to seeing some video demonstrations because the AO i have seen usually looks way worse than the images posted - especially since some effects like Sonic Ether's AO looks better the higher the resolution which is not correct.

    Get some side by side comparisons if you like since the Amplify Occlusion contains a perfectly setup scene for you.

    However in all honesty people will find a way to rip your asset one way or another, the exclusion of a Web Player demo would only lower the potential buyers since there are serious buyers and then there are those few who pirate. I pirated a tool once to test it out and then found out it wasn't good so I just deleted it, no need to bother the developer for a refund etc.
    Your product is too cheap to pirate anyway so the benefits do not outweigh the bad.

    That's just my personal rant anyway, I would be more than satisfied with a good video.
     
  24. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    I've been able to try Amplify Occlusion already, and I can say that HBAO is a bit faster for slightly better AO, the screenshots you can see on the asset store page are made with a resolution of 1920x1080 with Unity's fantastic quality setting.

    I'm currently trying to implement 2x2 and 4x4 deinterleaving with a separable AO kernel which should allow to use very large radii without any noticeable performance impact.

    You're not the first to ask for a video, and I'll definitely add one when possible ;)
     
    SilverStorm likes this.
  25. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    HBAO 1.4.1 has just been published to the store. It contains a fix for the error in the editor when you try to apply a preset in play mode.
     
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    hey dude... I just saw this asset and it is amazing... can't wait to try it on the GTX 1080 cards
     
    jimmikaelkael likes this.
  27. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I should also add that you should use this if ALL of your shaders are deferred... I just tested this in my Sanctuary level and forgot I was using Forward Skin Shaders :D... I am keeping this one around... I already have SSAO Pro, but more options is good...
     
  28. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    I don't understand... HBAO works with both deferred and forward. It has been used successfully too in deferred with forward rendered foliage without any artifacts.

    Could you please give a bit more details ?
     
  29. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I am using Alloy and my skin shaders are not playing nice with it...

    Here are some screenshots...

    Screenshot 2016-05-27 11.26.09.png
    Screenshot 2016-05-27 11.28.30.png

    It might be Alloy, I am using their forward skin and transmission shaders...

    Here is the split view of what it looks like... Screenshot 2016-05-27 11.31.00.png

    The problem goes away if I set the skin to deferred :)
     
  30. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    I'm really willing to fix this issue. I'm engaging a private conversation.
     
  31. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Update 1.4.2 is pending review.

    Changelog:
    • Added per pixel normals setting (GBuffer or Camera)
    • Added Max Distance and Distance Falloff settings
    • Fixed AO step size, allowing to get more interesting contact occlusion
    • Moved initialization to OnEnable instead of Start
    • Avoid to modify GUI.Label style directly as to not mess up the stats window
    • Renamed "Show Type" setting to "Display Mode"

    The per pixels normal setting adresses the transparency issue @KRGraphics had with Alloy's skin shader.
    Every customer can send me his invoice number if you wish to update before it is approved.
     
    jdraper3 likes this.
  32. jdraper3

    jdraper3

    Joined:
    May 28, 2015
    Posts:
    117
    I was having that issue with the skin shader as well - Thanks for the fix!
     
  33. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Well 1.4.2 has been published. To fix the issue with Alloy's skin shader, set the Per Pixel Normals to "Camera" in AO settings ;)
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    I'm new to using any type of AO solution, but I'm very much interested in any technique that can improve the final look of my games. However, I have to admit that I am yet able to discern any difference in the previous screenshots that show the original outdoor scene and one with AO and color bleeding. And the various comparisons of HBAO and SSAO via white/grayscale images don't really tell me anything either. Are there any better examples that clearly demonstrate what visual difference can be achieved? Or can someone point out just what is different/better that I'm just not seeing? Thanks.
     
  35. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    AO will give perceptual clues to your brain in order to help it to figure out where objects are placed in the surrounding space.

    Look at this 2 screenshots below, on the 1st one there's no AO and on the second one HBAO is active.
    the grasses on the foreground are much more defined:





    However, if you look at distant trees you'll see I've made a common mistake concerning the placement of HBAO in the post FX stack: It should be the 1st post effect in the stack. AO is rendered after the atmospheric fog which is bad.

    Any SSAO effect shouldn't be overused... If there's too much AO this not realistic and tends to be awful, you can adjust the intensity to suit your needs.
     
    Thrawn75 likes this.
  36. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    I can definitely see the difference you are pointing out, but I am beginning to wonder if such a difference is worth the performance penalty. On low-end hardware, what kind of performance hit can one expect with this? I develop for the Wii U so optimizing everything is crucial.
     
  37. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    The CPU cost is negligible, the GPU cost however can be highly expensive especially on low-end hardware... I prefer to be honest: such post FX is rather targetting mid to high-end hardware.

    This can be interesting, look at the notes:
    https://en.wikipedia.org/wiki/Screen_space_ambient_occlusion
     
  38. auroxi

    auroxi

    Joined:
    Dec 31, 2012
    Posts:
    82
    Hi,

    I have tried many SSAO solutions and not one of them can work properly with certain shaders/particle systems. I have a rain system and when it rains in my game using any SSAO solution so far I get this:

    http://imgur.com/etszv3e (big black squares everywhere where the 'splash' particle/shader is active)

    Is your solution likely to not have this issue?
     
  39. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Well It's hard to say without testing it... HBAO doesn't suffer the same problem as other SSAO concerning forward rendered cutout materials. But I can't be sure at 100%.
     
  40. rooson

    rooson

    Joined:
    Nov 2, 2013
    Posts:
    3
    Hi, I don't know if this something you can help with but in a WebGL build I see this:
    Note: Creation of internal variant of shader 'Hidden/HBAO' failed.

    and then I get a constant stream of this error:
    Invalid pass number (13) for Graphics.Blit. Material=Hidden/HBAO, npasses=1
    UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32)
    HBAO:RenderHBAO(RenderTexture, RenderTexture)
    HBAO:OnRenderImage(RenderTexture, RenderTexture)

    The number in brackets varies
     
  41. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    I'll look at this once at home.
    Could you please tell me which Unity version you're using ?

    Are you using the latest HBAO update ?

    Don't you have hit any shader keywords limit ?
     
  42. rooson

    rooson

    Joined:
    Nov 2, 2013
    Posts:
    3
    Unity version is 5.3.4p6
    HBAO version is 1.4.2
    Nothing's told me I've hit a shader keyword limit and it works in other builds so I'm guessing I haven't.
    Thanks for the response!
     
  43. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Well HBAO, as most SSAO on the store solution targets Shader Model 3.0 (it is clearly mentionned on package description).
     
    Last edited: Jun 6, 2016
  44. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Tried Unity 5.3.4f1 with HBAO v1.4.2.
    I can't see any problem...

     
  45. rooson

    rooson

    Joined:
    Nov 2, 2013
    Posts:
    3
    ok, thanks for your time!
     
  46. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    You're welcome!
     
  47. mikef

    mikef

    Joined:
    Apr 2, 2009
    Posts:
    56
    Hi, i just bought your asset and i'm unable to get it working in any way. The HBAO script continually stays turned off in the inspector, and i'm unable to toggle it.

    using unity 5.3.4p6 64 bit

    Any help would be appreciated!
     
  48. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Could you please tell me which platform ?
    I guess you have warning and/or error in the console, no ?

    Also please try with a stable release, these patch versions are often broken honestly.
     
  49. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    First off, awesome post effect you got there. Really outdoes other SSAO effects I tried when it comes only darken what should be darkened (as long as the settings are correct).

    Quick question though:

    I am trying to use the bleeding for enhancing the effect of self illuminated textures at night. Now, the problem is that light bleeding also affects the specular highlights of metallic materials, leading to lots of ugly artefacts (because of non perfect AA specular highlights always have some kind of "shimmering", which is made worse by the bleeding effect), and somewhat overdone bleeding (because metals can get extremly bright at where the specular highlight is, leading to extreme lightbleeding to nearby objects in shadow).

    If you don't know what I mean, I can make some screenshots.

    I tried to tone down the effect so it affects the specularity less, but to no avail. Is there any way to be "selective" about what the bleeding effect selects by settings? Would it be possible in a future version to make the bleeding be more selective with an option (like only take emissive parts of materials into account if this option is switched on)? I think this would help tremendously getting that nice Screenspace light bleed from emissive parts, while not affecting the specular highlights.


    Regards

    Gian-Reto
     
  50. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    584
    Glad you like it :)

    So for your problem, yeah a screenshot could help me to figure out exactly what you're talking about ;)
    I'll try to see what I can do with your proposal of a new option to take emissive in account.
     
unityunity