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:
    653
    I'll probably do that soon ;)
     
    syscrusher likes this.
  2. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    382
    Ok, my issue was solved! The product looks great by the way, rating 5 stars in a sec
     
    turboscalpeur and jimmikaelkael like this.
  3. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hello there,

    Any chance for this to work on VR with Stereo-Pass Single Render? I'm testing this using an Oculus DK2.

    I see everything pretty strange... but also I get a lot of errors like this:

     
  4. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Hi,
    Could you please send me your invoice number in PM ?

    I'll try to send you a fixed build asap.
    VR single pass isn't implemented yet but it's on the road for the next release.
     
  5. roomera

    roomera

    Joined:
    Sep 27, 2016
    Posts:
    17
    @jimmikaelkael - We're experiencing issues with faint black lines that occur when using half or quarter resolution settings. For reference, we're seeing those lines within VR - those same lines don't seem to show up in the game view.

    Do you have any initial thoughts on how we could address this?

    Thanks!
     
  6. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Hmmm, on top of my head I can't see what could be the problem, most likely It requires investigations.
    Which per pixel normals type are you using ? (Please check when it's in play mode as it can change at runtime if the setting isn't available for the current rendering type).
     
  7. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    131
    Does it work with VR (Rift/Oculus)?
     
  8. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Yes, but the current release doesn't support Single Pass Stereo Rendering, I'm currently in the process of implementing it.

    In any case, you can always try the free trial package.
     
  9. roomera

    roomera

    Joined:
    Sep 27, 2016
    Posts:
    17
    These are my settings during play mode. You can clearly see faint horizontal lines on the Vive... let me know if I have an incorrect setting
     
  10. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Are you using Single Pass Stereo Rendering ? HBAO is not yet ready for that...

    You could try to set the blur amount the "None". If it still persist, try to set Per Pixel Normals to "Reconstruct", and if you still get the black lines set Resolution to "Full". Let me know at which of these steps you get a normal output.
     
    Last edited: Oct 1, 2016
  11. roomera

    roomera

    Joined:
    Sep 27, 2016
    Posts:
    17
    It looks like setting per pixel normals to "reconstruct" did the trick. Looks like there's an issue on any resolutions lower than "full" when the normals are either set to Camera or G Buffer.

    Thanks for your help!
     
  12. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Ok, can I know a bit more about your setup ?

    - VR device
    - Unity version
    - DirectX version

    Thank you very much!
     
  13. roomera

    roomera

    Joined:
    Sep 27, 2016
    Posts:
    17
    - VR device: HTC Vive
    - Unity version: 5.4.0f3
    - DirectX version: 12
     
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Sorry for the late confirmation, but yes it works with SteamVR and also The Lab Renderer.
    The Lab Renderer vr_standard shader requires a modification so that it can write to Z-Buffer but I can provide it on demand ;)
     
    AndersMalmgren likes this.
  15. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    31
    Just tried it and working perfectly with a perspective camera, however when I switch to orthographic I haven't been able to get it working correctly with all the settings I've tried. Would it be possible to share a demo of it working with an orthographic camera?
     
  16. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Are you sure you are using the latest 1.7 update ?

    Theoretically it should work out of the box with orthographic cameras.
    The best test to try is the HBAO demo scene, activate the AO only view and switch the camera to orthographic.
     
  17. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    31
    Yep absolutely, freshly downloaded and just checked the readme - says 1.7.

    So I open up the demo scene, select the camera and switch to orthographic, then I switch to AO only and this is the result;



    When switching back to perspective it's working fine. Using Unity 5.5.0b4
     
  18. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Unity betas are not supported, have you tried with the latest stable release ?
    Which platform are you building for ?
     
  19. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,647
    The trial version of you tools works very well with Unity B7. I'm currently evaluating your product on a (real) open world. Everything are fine.
     
  20. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    31
    Ah you're absolutely right, just tried the latest stable version and it's working correctly there. Had no idea there would be such a problem using the latest beta releases. Thanks for the support!
     
  21. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Glad it's working :)

    Anyway thank you for your report as I'm now aware of an eventual future problem.
    I've tried to reproduce it and YES there's definitely a problem regarding HBAO with orthographic camera in Unity 5.5 betas.

    I've checked Unity's cinematic effects package and it suffer the exact same bug so I'm watching this carefully.
     
  22. P4p3Rc1iP

    P4p3Rc1iP

    Joined:
    Feb 17, 2015
    Posts:
    13
    We have a strange issue. In editor everything looks fine, but in a build it seems the AO is inverted. Instead of darker areas, we get light areas. Is there some strange setting I've missed? Running: Unity 5.4.2f2, DX11, deferred, linear.

    Editor:



    In build:
     
  23. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    That's strange yeah... I'm unable to reproduce it.
    Is it possible for you to send me a repro case ?

    EDIT: Do you have color bleeding enabled or not ?
     
  24. P4p3Rc1iP

    P4p3Rc1iP

    Joined:
    Feb 17, 2015
    Posts:
    13
    I've spent some time to try and make a repro case but I couldn't outside of the project (Sadly I can't send you the whole project...). However, I did (sort of) figure out the problem:

    The build should run in deferred rendering (though log says "player settings"). HBAO doesn't seem to recognise this, so it automatically changes Per Pixel Normals to "Camera" instead of the default "G buffer". When the rendering mode is then forced to deferred, Per Pixel Normals doesn't change and is still "camera".

    So right now the workaround is this:
    1. launch a build with HBAO disabled
    2. Ingame, switch/force it to run in deferred (instead of "player settings")
    3. Enable HBAO
    4. Everything is fine!

    The odd thing is that I'm pretty sure it is actually running in deferred in the build, because it's clearly not running in forward as that gives all kinds of issues with our shaders.

    Could it be that HBAO doesn't recognise whatever is set in "player settings" as deferred? Though in that case it should also cause issues in other scenes/projects, right..?

    Another odd thing is that this problem didn't occur in earlier builds, so something in our project must've changed. I'll have to do some more investigation on monday and our other programmer is back in the office.

    Edit: Color bleeding is disabled, everything is on the default settings. I've also deleted and re-imported the whole package. No difference.
     
  25. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Thank you for feedback.

    Well such rendering path detection was a problem in earlier versions but it has been fixed some time ago.

    Clearly I'm missing something... I've never seen Unity saying it uses "Player Setting" as rendering path in builds.
    Wasn't it in the editor ?

    In HBAO.cs (line 767), there's a method that is responsible for detecting the rendering path, you can clearly see there's a special treatment for "Player Setting" in editor but not in build:
    Code (csharp):
    1.  
    2. private bool isDeferredShading()
    3. {
    4. #if UNITY_EDITOR
    5.     return (!_hbaoCamera.orthographic && (_hbaoCamera.renderingPath == RenderingPath.DeferredShading ||
    6. (_hbaoCamera.renderingPath == RenderingPath.UsePlayerSettings && UnityEditor.PlayerSettings.renderingPath == RenderingPath.DeferredShading)));
    7. #else
    8.     return (!_hbaoCamera.orthographic && (_hbaoCamera.renderingPath == RenderingPath.DeferredShading));
    9. #endif
    10. }
    11.  
    Are you instanciating the camera or something else specific with your setup ?
     
  26. P4p3Rc1iP

    P4p3Rc1iP

    Joined:
    Feb 17, 2015
    Posts:
    13
    Sorry, I was mistaken, that was indeed in editor.

    In the build it refuses to print
    Code (csharp):
    1.  Debug.Log("Cam Path: "+Camera.main.renderingPath);
    So I'm not sure what it does...

    Only after I set a path will it print:
    Code (csharp):
    1.  Camera.main.renderingPath=RenderingPath.DeferredShading;
    We do re-parent the cam as soon as the player spawns. Right now this happens immediately on starting the game, so I suppose that could be an issue..? As soon as we have a menu, etc. there will be some time between starting the game and stuff happening to the camera.
     
    Last edited: Oct 31, 2016
  27. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Strange, it prints nothing ? not even an exception ?
    Have you tried enabling debugging in build ?

    If you are reparenting the whole gameobject I don't see why this could be a problem...
     
  28. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Well I've found a major problem: Unity exposes the UsePlayerSetting in builds and HBAO is unable to detect the correct rendering path in some cases...

    This explains your problem @P4p3Rc1iP
    Working on a fix right now!

    EDIT: Well, as a temp fix you can change the "isDeferredShading" method in HBAO.cs to
    Code (csharp):
    1.  
    2. private bool isDeferredShading()
    3. {
    4.     return _hbaoCamera.actualRenderingPath == RenderingPath.DeferredShading;
    5. }
    6.  
    I'm submitting 1.8 update for review.
     
    Last edited: Oct 31, 2016
  29. P4p3Rc1iP

    P4p3Rc1iP

    Joined:
    Feb 17, 2015
    Posts:
    13
    Ah yes, that explains! Thanks! :)
     
  30. lukas-chrapek

    lukas-chrapek

    Joined:
    Sep 13, 2015
    Posts:
    31
    Hi Michael

    We are using your HBAO for our game Vaporum and one issue occurred, we see some kind thin semi transparent lines on screen, we have in most of the game camera in horizontal position. It weird because before I didn't see this.
    We using Unity 5.4.0f3 ans Alloy Shaders. Inside editor is this issue less visible then in the build. We also use SSAA and this issue will lost after setup SSAA to 1.2x resolution or more.
    In the link you will find video with issue and screenshot of settings (per pixel normals in video are setup on GBuffer) with our settings.
    Also I try switch Per Pixel Normals from g-Buffer to Reconstruct and that fix the problem but it will wipe out AO from normals maps.

    https://dl.dropboxusercontent.com/u/52623513/HBAOReportMichael.zip

    Thanks for your help.
     
    Last edited: Nov 10, 2016
  31. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    HBAO has been updated today, could you please check with the latest version and report if the issue is still there ?
     
  32. VISIONSBOX

    VISIONSBOX

    Joined:
    Nov 7, 2014
    Posts:
    14
    Is there a way to add Ambient Occlusion to transparent objects? I have an application which takes camera input and overlays a 3D model. The model has no AO at it's base. It would be great to just add a transparent plane on the ground and add a special shader that allow AO to be applied.
     
  33. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Is it possible for you to send me a small test project ?
     
  34. turboscalpeur

    turboscalpeur

    Joined:
    Nov 29, 2015
    Posts:
    302
    Small comparative Screens of the HBAO, you Rock !!!

    I have tested far away mostly all the ambient occlusion in the Asset Store, then I made definitely my choice here.
    The variants of Settings and how is easy to set up make a big difference for me, moreover the Results, the smoothly Perfs in it are just the best I obtained with an AO in Unity.

    Hardly tweaked closely, I show off on screens some transitions closer and widely too^^ These are obviously my own sets, you can so easily tweak the HBAO in your own way...I'm so amazed of this!

    Without HBAO:


    With HBAO:


    Without HBAO:


    With HBAO:


    Without HBAO:


    With HBAO:


    Without HBAO:


    With HBAO:


    Without HBAO:


    With HBAO:


    I guess it's enough^^

    Cheers,
    turboscalpeur
     
  35. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    Hi I bought this package and am generally pretty happy with it but I was wondering if for a future release you could add a slider that controls how much directly lit areas of the scene mask away the ao ( they currently dont do that at all.)

     
    macdude2 likes this.
  36. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Yeah I already have a beta release ready to support this. It integrates into the rendering pipeline and does PBR lit AO, I'm contacting you by PM.
     
  37. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    131
    Is there any ETA for release?
     
  38. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Not really... However it should be released in the coming weeks, before christmas.
     
  39. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    sweet tried the beta works as advertised :)
     
    turboscalpeur likes this.
  40. semaphore

    semaphore

    Joined:
    Mar 21, 2011
    Posts:
    49
    Hello,

    Can we get the beta please? We need to utilize the fix env_warby mentioned.
     
  41. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Sure!
    Please send me your invoice number in a private conversation, I'll send you that build asap ;)
     
  42. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,234
    I have a little problem that may be a bit hard to notice here, but please have a look:


    The pillars in front are influencing the AO on the stairs behind them.
    It looks a bit like the pillars are "glowing".
    Any idea?
     
  43. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Well you'll get a bit of that effect (haloing) in almost every SSAO solution, but in your case it's surely exagerated... And shouldn't be.

    Hard to say just like that... Is your object scale correct ?
    Which Unity version, which platform ?
    Deferred, Forward rendering ?

    If you can strip it down into a test project I could look at it.
     
  44. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,234
    As you can see the radius is very big.
    As soon as I reduce the radius it gets much better, but I would still like to have this big radius. :)

    Unity 560b1
    Forward
    Linear
    PC Standalone
     
  45. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Is your object scaled correctly ?

    If you're increasing radius, you could try to increase the "max radius pixels" setting as well.
    Let me know if it has some effect.

    EDIT: What's your radius currently ?
    Are you using Deinterleaving ?
     
  46. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    69
    Hi,

    Unity 5.5.0p3 Pro

    I started noticing the following issue when updating to Unity 5.5. Please see below for the screenshots.
    In the first screenshot, with HBAO enabled, I can see through walls. Two characters standing can bee seen through the wall.

    The 2nd screenshot is when I disabled HBAO, which then makes the wall look normal again.

    I have noticed some walls and trees having this see-through issue. This seems to happen when the "per Pixel Normals" is set to "G Buffer". When I set it to "Camera" or "Reconstruct", the see-through issue does not happen.

    I am using Deferred Rendering Path

    Maybe, is there a setting that I am overlooking?


    Thank you!


    HBAO is enabled
    upload_2017-1-8_3-7-20.png


    HBAO is disabled
    upload_2017-1-8_3-8-15.png
     
  47. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Seems to have to do with your material not writing to depth buffer.
    If you set the wall materials to Default I guess you will not get this see through issue.
     
    tachyon-particle likes this.
  48. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    69
    Your solution does work, but for the leaf material of the trees that were being used, it will look a little different.

    I was able to change the affected see-through walls and trees to utilize the Standard shader to make it work. But, for the shader used on the leaves of tree, the Standard shader will make it look slightly different due to the differences in shader rendering, but it is acceptable.

    Here are the shaders causing the see-through effect, of which, I had to change to use the Standard shader.

    Shader used on the wall material
    upload_2017-1-8_19-6-20.png

    Shader used on the leaf material of the trees
    upload_2017-1-8_19-7-44.png


    Thank you so much for your quick reply!
     
    Last edited: Jan 9, 2017
  49. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Well, I suggested to switch material or shader just as a test to confirm the issue was related to your materials, but I can understand that's not what you want to use at the end.

    For the "Probuilder/Standard Vertex Color" shader I think this is expected as this is not really a production shader I guess but rather a tool to during development. That said I can help you to fix this shader to work with HBAO if you really want it to.

    For the "Tree Creator Leaves Optimized" shader this sounds really strange as I've already used some Trees with this shader and they don't have any problem (I tested it again this morning with Unity 5.5.0f3). Which asset are your trees from, could you send me a link please ?
     
  50. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    69
    The tree prefab name is "Spruce_1" from the following asset:

    Stylized Nature Pack
    https://www.assetstore.unity3d.com/en/#!/content/37457

    Below is a screenshot close-up of the tree leaves. Circled in red, a brick wall can be seen through it as if there was some kind of transparency or x-ray like effect.

    I am using the latest Unity 5.5.0p3, it's the patch 3 version, and not the f3, if that makes any difference or not.

    Thanks

    upload_2017-1-9_1-20-20.png
     
    Last edited: Jan 9, 2017
unityunity