Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SSAO Pro - High Quality Screen-Space Ambient Occlusion

Discussion in 'Assets and Asset Store' started by Chman, Oct 14, 2014.

  1. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Version 1.2.3 is available !

    Changelog (1.2.3) :
    • Fixed : Unity 5 beta compatibility. Simply extract the "Unity5_compatibility" package.
     
  2. cowtrix

    cowtrix

    Joined:
    Oct 23, 2012
    Posts:
    322
    Hey @Chman. Just noticed a problem. The trees below are called with Graphics.DrawMesh(), and as you can see they're not being treated properly by the SSAO. A couple of notes:
    • In forward rendering, the trees do not appear in the SSAO buffer at all.
    • In deferred rendering, the trees partially appear, but blended with the terrain behind and cleared by the skybox (far right). It's a bit hard to see but it is happening.
    • Changing the render queue of the shader on the trees doesn't appear to have any effect. They are using the stock Cutout Diffuse shader in the screenshots.

    Any thoughts on how to resolve this?
     
  3. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    I think I know what the problem is, any chance you could send me simple test case to save some time ?
     
  4. cowtrix

    cowtrix

    Joined:
    Oct 23, 2012
    Posts:
    322
    Hey Chman, any progress on that bug? I just noticed that if you call Graphics.DrawMesh without passing it a camera (or even passing it null!), the bug does not occur.

    Edit: Okay, so just not setting the camera on the Graphics.DrawMesh call has fixed it. However now I'm looking at another bug, which is that SSAO.OnPreRender() is consuming a pretty massive amount of resources (about 8ms). This wasn't a problem on previous versions.
     
    Last edited: Feb 5, 2015
  5. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Check your PMs :)
     
  6. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    Hello! Thankyou for writing this plugin, it's been performing extremely well and I really like visual results I can achieve with it. That said, I recently updated from 1.1 to 1.2.3 and am experiencing an issue with camera based reflections.

    I narrowed down my test case to a couple of cubes over a default Daylight Water prefab straight out of the Water (Pro Only) package. As you can see in the picture, when SSAO is enabled, it's like the reflecting camera's clear is white. It still reflects scene objects normally.



    I am using Unity 4.3.4. The effect was not interfering with reflections in SSAO Pro 1.1, and none of the settings I tried (deferred vs forward, directional vs spot, SSAO Mode 1.2 vs 1.1 (legacy), skybox vs no skybox) made a difference.

    Any idea what's causing this?
     
  7. gyltefors

    gyltefors

    Joined:
    Apr 5, 2013
    Posts:
    48
    This SSAO plugin seems to be exactly what I need for my game, though as I use Water Pro (water4), I am concerned about the issue above. Any feedback on this?
     
  8. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Sorry about the late reply, I'm looking into this. In the meantime, SSAO Pro 1.3 will be released tomorrow and you'll get an option to use the default depth map instead of the high precision one (so, like 1.1 did which would fix the issue you're getting).
     
  9. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    A new version is up !

    Changelog (1.3) :
    • Added : An option to switch back to the default depth precision if you can't or don't want to force high precision depth buffer. This works ok with the deferred rendering path but will show artifacts in forward mode, like version 1.1 did.
    • Modified : Tweaking the Distance Cutoff now helps getting way better performances with the "High Precision" mode.
    • Fixed : No more Tiled GPU performances warning on Xbox360 and mobile platforms.
    • Fixed : A few bugs with RenderTextureFormat.
    • Fixed : Issue with the Viewport Rect.
    • Misc : Documentation update.
     
  10. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    I've just updated from 1.2.3 to 1.3 and I've run into an issue

    (I'm on Unity 4.3.4f1, Windows)

    the plugin itself is disabling itself with the message "Unsupported shader (SSAO)." but on closer inspection the shaders are kicking up errors. This is what I get when I reimport the SSAO Pro/Resources directory



    I tried removing the SSAO Pro directory and reimporting (even though 1.2.3 was working) and am getting the same result. Any idea what could be going on with this and how I could resolve it?
     
  11. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Sorry about that, I just pushed a fix to the Asset Store.

    Changelog (1.3.1) :
    • Fixed : Shader compilation on DirextX 9 and OpenGL.
     
  12. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    Awesome! I just grabbed 1.3.1 and both issues are resolved. Thankyou for the quick response!
     
  13. DeveloperRLA

    DeveloperRLA

    Joined:
    Jun 17, 2013
    Posts:
    53
    I am having an issue with SSAO pro significantly increasing the number of batches and triangle count. I've got 3 images that show a comparison between SSAO pro turned on, turned off, and also unitys SSAO. Nothing else with the scene changes. Any ideas what might cause this? Thanks a lot!
     

    Attached Files:

  14. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Yes, that's because of the "High Precision" checkbox. Uncheck it to use the default Unity depth map, the number of draw calls will go down drastically.
     
  15. DeveloperRLA

    DeveloperRLA

    Joined:
    Jun 17, 2013
    Posts:
    53
    Awesome, I probably should have tried that before posting this. Thanks a lot for the quick response!
     
  16. Zylex

    Zylex

    Joined:
    Nov 25, 2008
    Posts:
    238
    Hi Chman, Great image effect! Loving it so far only we seem to run into an issue when in forward using AA and SSAOpro. It gives an outline effect as illustrated below:



    It happens with particles in the background. Is there any way we can resolve this or could you fix it internally in your shader? We are running in Unity 5 , forward, with DX11 enabled if that is of any help.
     
  17. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    By AA do you mean multi-sampling or image-effect AA ?
     
  18. Zylex

    Zylex

    Joined:
    Nov 25, 2008
    Posts:
    238
    I mean the built in AA from Unity. So not the image effect.
     
  19. zbrusher

    zbrusher

    Joined:
    Dec 12, 2012
    Posts:
    19
    Very good package Chman, I also used Colorfur, and I recommend it. It is currently being used by Soccer Rage http://steamcommunity.com/sharedfiles/filedetails/?id=400117437 , and brings a little extra touch of quality keeping a good FPS. Guys check out our game and if you want please vote for it. Support a unity developer and supporter of assets store.
     
    Chman likes this.
  20. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Quick maintenance release !

    Changelog (1.3.2) :
    • Fixed : Alpha channel preservation (useful for some old image effects like Glow).
    • Fixed : Better Unity 5 compatibility.
     
  21. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    SSAO Pro is part of the new Level 11 program, 50% off until March 31 ! Note that Level 11 is only available to subscribers and Pro users.
     
  22. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Btw, '** Requires Unity 4.x Pro ** or '** Requires Unity 5.x **' :p
     
    chiapet1021 and Chman like this.
  23. ronjart

    ronjart

    Joined:
    May 16, 2013
    Posts:
    100
    Just bought this and tested with unity 5 RC4. I get this:

    Unsupported shader (DepthNormal).
    UnityEngine.Debug:LogWarning(Object)
    SSAOPro:Start() (at Assets/SSAO Pro/Scripts/SSAOPro.cs:171)
     
  24. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Double click the Unity5_compatibility.unitypackage file in /SSAO Pro/ to extract it. Now that Unity 5 has officially been released I'll upload a special version (probably tomorrow) for Unity 5 so you won't have to do this manipulation in the future :)
     
  25. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Done. Unity 5 users don't have to extract the Unity5_compatibility.unitypackage file anymore, unless they use the Unity 4 package ! The Asset Store will now download the correct package for Unity 5 users.
     
    kurylo3d likes this.
  26. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Here's a new quick video featuring the Viking Village ! SSAO Pro + Unity 5 :

     
    radimoto likes this.
  27. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I noticed in the above Viking demo that the SSAO effect creates a dark band on the thatch of a hut at the very end of the video. You can see it in the SSAO only version and in the scene. Is this something that can be corrected?
     
  28. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Yes indeed, for some reason I left the "High Precision" checkbox ticked but you don't need it in Unity 5 (it was for Unity 4 with the Forward rendering path, somehow it doesn't work properly with two sided cutout materials in Unity 5). I'll see what I can do about it, although like I said you don't need to tick this checkbox anymore.

    With High Precision checked :


    High Precision unchecked :


    And now I have to redo the video... :eek:
     
    hopeful likes this.
  29. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi,

    thanks for the great asset. I have the same problems with cutout materials and new Speedtree's for Unity5. Would be great if you will find a solution for this issue :)

    A great feature would be, picking the colors of the main tex to colorize the AO map.

    Did you have updloaded the release you wanted to already?

    Kind regards
     
  30. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Simply disable High Precision, it should work fine in Unity 5 when working in Deferred mode (which is the default rendering path now). Let me test it with SpeedTree... Yep, it works :)

    I'd like to do that (as well as fetching the lighting pass for the Lighting Contribution feature) but I'm not sure how I can access the gbuffer in Unity...

    You mean the "Unity 5 version" ? Yes, it's up, go get it on the Asset Store :)
     
  31. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    its also half off the price if your a unity 5 pro owner lol. Access to level 11 in the asset store. :p
     
  32. mattcscz

    mattcscz

    Joined:
    Mar 7, 2010
    Posts:
    411
    Hi,

    I bought the SSAO plugin the other day as unity's seem to have stopped working =)

    Everything works great except one little thing, when I am using the Mobile / Vertex coloured_TwoSide shader the plugin seems to make the object slightly transparent, is there any way around this?

    IMG:
    Thanks in advance!
     
  33. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Hello @Chman , I just bought this asset and it looks fantastic! I would really love to be able to use it for Ghost of a Tale but I met a problem which unfortunately makes it unusable for me: the effect itself is see-through. It means meshes behind the meshes are "visible" in the SSAO. That's obviously a big issue.

    I'm on Unity 5.0 using DX11. I really hope there's a way to fix those issues because as I said the effect looks great...

    Oh just before I posted I see that @mattcscz mentions something similar. I'm not developing for mobile but all my meshes do use vertex coloring. Maybe that's a clue there...

    Edit: Just for the sake of clarity when I say vertex coloring that includes vertex alpha of course.
     
    Last edited: Mar 11, 2015
  34. mattcscz

    mattcscz

    Joined:
    Mar 7, 2010
    Posts:
    411
    Mines not for Mobile either, it's just the only 2-sided shader out of the box >.<

    In my head what's happening is as the shader is 2 sided it's creating an effect which tries to make the SSAO from both sides, making it appear see-through.

    Are your materials 2 sided Seith?
     
  35. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Nope, they're not. What I see is definitely not SSAO from the other side of a mesh but the one caused by meshes well behind it.
     
  36. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Is that a standard shader ? I can't find it in the shader list...

    SSAO Pro makes use of the depth buffer so it can't be applied to transparent objects (except "cutout" shaders). The same goes for Unity's SSAO. The SSAO pass is rendered after opaque geometry but before transparent geometry. Are you working with a custom shader ? The "see-through" effect you're seeing is probably because your RenderType tag isn't set correctly. That would be my first guess... If it's not a custom shader, could you point me to the one you're making use of ?
     
  37. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Yes, those are custom shaders created with Shader Forge. And the AmbientObscurance script from Unity (which I've been using until now) doesn't have that issue (if that can help you pinpoint the problem). Here's a layered tessellation shader I use.
     

    Attached Files:

  38. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hmm indeed, same issue with the default Ambient Occlusion script but the Ambient Obscurance one works fine... I'll investigate, thanks !
     
  39. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Fingers crossed! I hope you can fix the issue. Now that I've seen what your AO can do, I really want to use it! :)
     
  40. mattcscz

    mattcscz

    Joined:
    Mar 7, 2010
    Posts:
    411
    Could you suggest any 2sided shaders you've used that work well with the product =)? Thanks
     
  41. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    The easiest way to get a 2-sided material would be to simply add Cull Off to the standard shader. I just tested it, it works fine (no more see-through effect) but the back-sides aren't properly lit as expected (normals are in the opposite direction). Generally speaking, using 2-sided materials is not a good idea. Can't you simply duplicate your faces and flip the normals ?

    Some progress : the issue comes from DepthTextureMode.DepthNormals. For some reason the camera isn't picking any normal from your shader in Unity 5. But it does in Unity 4 and the effect works correctly there. I'm trying to figure out if it's a Unity 5 bug/change or a Shader Forge bug...
     
  42. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    @Seith : so, the issue doesn't come from Unity but from the shader generated by Shader Forge. The shader simply doesn't work with the Deferred rendering path (the one from Unity 5, not the legacy one), so if your camera is set to Deferred it actually renders your object in Forward, which doesn't work well with tessellation (it will return the normals from the initial object, before any displacement / tessellation is done for some reason). Actually you can get it to work by switching to the legacy deferred rendering path but I would recommend against it for a bunch of reasons.

    I've done some digging and it looks like Shader Forge isn't fully compatible with Unity 5 yet, it's still in beta. Once Shader Forge is able to generate shaders that work with the Deferred rendering path (default one in Unity 5), it should work as expected. In the meantime, there's unfortunately not much I can do...

    So that's why your shader won't work properly with normal-based post processing effects in Deferred. It works with Ambient Obscurance because this effect doesn't make use of the normals, only depth.

    Edit : according to its changelog, the next Shader Forge version should support Unity 5 just fine :)
     
    OnePxl likes this.
  43. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Thank you so much for investigating the issue thoroughly! I'll wait for the Shader Forge update then, and I'll report the result here... :)
     
  44. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    @Chman Just for closure, @Acegikmo published today a new version of Shader Forge which adds support for deferred mode and that took care of the issue! Even the tessellated shaders look great now with you AO. Cheers! :)
     
    OnePxl, Acegikmo and Chman like this.
  45. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I noticed some SSAO solutions don't work well or play nice with speedtree foliage among other things. Does this asset resolve those issues?
     
  46. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    I think it should be possible get the thickness of the object scene by subtract the depth back from
    depth front. Its a thought only. :)

    Disable High Precision solves some of the problems on speedtree foliage.
     
  47. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    The "High Precision" checkbox (which is renamed to "Alternate Depth Map (Unity 4)" in the coming version) should only be used in Unity 4, mainly in Forward mode. As for SpeedTree, it works ok in Unity 5 / Deferred. It will break in Forward, not much I can do about that unfortunately (incomplete normal set returned by _CameraDepthNormalsTexture).

    Oh, and SSAO Pro 1.4 is coming soon with a few improvements here and there, new features and slightly better performances on Unity 5 / Deferred :)
     
    Seith likes this.
  48. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Great, thanks a lot. Does Linear Light made any changes to the visibility of SSAO Pro?
    I use Deferred HDR + Linear only.
     
  49. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Linear works fine, and I'm always working in Linear anyway ! The AO pass will be lighter as expected but you can simply adjust the intensity to get the harsh result you would get in Gamma :)
     
  50. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    SSAO Pro 1.4 is here !


    Changelog (1.4) :
    • Added : New "Ultra" preset (20 samples).
    • Removed : The "High Precision" field had no use in Unity 5 and will only displayed in Unity 4.
    • Misc : Global refactoring, various tweaks & optimizations.
    • Misc : Shader keyword count down to 7.
    • Misc : Documentation update.
    • Note : Due to some heavy refactoring, upgrading from previous version of SSAO Pro may fail. It's best to remove SSAO Pro from your project entirely and reimport the last version.
     
    Seith and TanselAltinel like this.