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. Psycho-Designs

    Psycho-Designs

    Joined:
    Oct 9, 2013
    Posts:
    14
    I'm looking for an Ambient Occlusion solution that allows us to exclude objects/layers. I know you mentioned you're looking into it on page 1. Is that still the case?

    Thank you :)
     
  2. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    It can't be done properly without sacrificing speed and quality, unfortunately, so no, I won't implement that feature :(

    You could potentially use a multi-camera setup (render excluded objects after the SSAO camera pass is done) but I haven't tested this extensively so there may be edge cases.
     
  3. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    I've been using SSAOPro since 1.1 release and having my project upgraded to Unity 5, it's nice to see it keeps up still. Most people say that SSAO is an unnecessary process, adding very few details only 5% of the players will realize, but I disagree, it adds a lot, and for some scenes it does better work than enlighten.
    So, congrats :D

    I have a question that is not directly relevant, but is shader keyword count important? I mean is it performance wise effective or what?
     
  4. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Thanks :)

    Regarding shader keywords... It's not about performances, it's a handy feature in Unity to easily create shader variants (see this). Unfortunately there's a keyword limit per project (128 in Unity 5, 64 in Unity 4 minus the ones already used by Unity) so it's best to use as little as possible to leave some room to other assets (do a search for "shader keywords exceeded" on the forum, you'll see what I mean). I could go down to 0 keywords for SSAO Pro but it would be a pain to maintain all the variants myself.
     
  5. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    Oh, I see, thanks. I'm not good with understanding of graphic pipelines, but the document explains a lot. I'm also using Alloy and couple of other assets that will fill up the keyword limit. Though my project is stable at the moment, I can imagine how can that be a pain for larger projects.
     
  6. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Hi, I noticed that when I updated to the latest version (1.4), it seems to have removed the 'noise' texture that was in 1.3 - I can't see it at all in the SSAO Pro directory, and because I deleted the original folder before importing I've lost it altogether. Was it removed on purpose or is this an accident? The SSAO looks a lot better with the noise texture so I'd love to get it back.

    Thanks, great asset.
     
  7. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hello,

    The noise texture is in /SSAO Pro/Resources/. I just checked the package from the store, it's there. Maybe try re-importing it again ?
     
  8. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    I'm trying this in my VR game, does this use depth? The effect is there but at one depth level, like a pane of glass across the game that has the SSAO on it. It's on two cameras in Unity5.
    Thanks
     
  9. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Yes, it uses depth & normals but it doesn't have any depth offset, it starts at the camera. So I'm not entirely sure what you can do to reduce the effect you're seeing, and unfortunately I don't have any VR device...
     
  10. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    fair enough, thanks for the info.
     
  11. potatojin

    potatojin

    Joined:
    Apr 11, 2012
    Posts:
    23
    I'm getting the error "Unsupported shader (SSAO)."

    Any idea what could be going wrong?

    Edited:

    FIXED!

    I tried deleting all the source files and re-importing, leaving everything in its default locations -- now it works...

    Is it not possible to put the files elsewhere? I hate clogging up the root of my project with third party assets.

    Thanks!
     
    Last edited: Apr 8, 2015
  12. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    You should be able to move the folder safely, the only thing that'll broke is the welcome screen... But that will be fixed in the next update anyway :)
     
  13. Remiel

    Remiel

    Joined:
    Oct 17, 2012
    Posts:
    105
    I'm having trouble with Cutout objects in Unity 5, forward rendering. I am using Standard shader set to Cutout.
    See the effect I am getting in the screenshot:
    SSAO issue.png
    For some reason, SSAO shades the invisible parts of the quad. The same thing happens even if I am using Transparent variant of the standard shader.
    Setting the render mode to deferred fixes the issue, however, I can't use the deferred mode because of Unity's bug with speed tree shaders.
    Do you have any idea why this is happening or how to fix it?
     
  14. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    AFAIK it's a limitation of the Forward rendering path, unfortunately. SSAO Pro needs access to the depth and normal buffers to compute the AO factor for each pixel. So far, Deferred & Forward give you access to these buffers. The difference comes from how the normal buffer is computed. In Deferred, you'll get a complete buffer with geometry and surface normals (from normal maps, cutouts etc). In Forward, you only get normals from the geometry data.

    Let me show you using a quick debug view from a sample scene (the barbed wire in this scene is using a Standard Cutout shader). These are the normals in Deferred :
    deferred.png

    And in Forward :
    forward.png

    As you can see, you don't get all the fine details with Forward because Unity doesn't expose them. This is why you won't get as much AO details in Forward as in Deferred, and in some cases like this one it can cause issues. You'll get the exact same problem with Unity's SSAO effect or any other normal-based image effect.

    I'm not really sure how to bypass this issue. I've looked into it a few weeks ago but without result. If anyone knows a way to get full normals in Forward I would love to hear it.
     
  15. rcalt2vt

    rcalt2vt

    Joined:
    Jun 6, 2009
    Posts:
    36
    In Unity 4, to get full normals you needed to modify Unity's internal Camera-DepthNormalTexture.shader to also write out the normals from the texture instead of just the geometry normals. Not sure how much of this has changed for Unity 5 as I have not looking into it.
     
  16. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    I did something similar in Unity 4, but it comes with a massive downside : the draw call count goes through the roof as most of the scene needs to be rendered twice... So it's quite impractical and it's generally a case by case scenario, meaning you'll need a custom replacement shader per game (normals, vertex animations etc) :(
     
  17. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Hey man. I just purchased your asset and it is one HELL of a plug-in, but I'm having some issues with transparent objects, particularly the hair shader in Alloy. When you enable SSAO pro, you can see the background geometry through the hair (it's more obvious if you enable show AO). I've already told the designers of Alloy about it. I'll post a picture of this later
     
  18. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Here is the issue I am having... I turned the transparency to 0 so you can REALLY see the issue... you can see the wall behind the character. I am using Deferred Rendering.
     

    Attached Files:

  19. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hey @Neptune_Imaging !

    Issues with third-party shaders all come down to one thing : the way they write into the depth (and normals in some cases) buffers. I'm not really familiar with Alloy so I'm not sure what the Hair shader is doing under the hood and the doc is unfortunately not helpful. My first guess would be a wrong RenderType but it's hard to say. I'll see if I can get my hand on Alloy. In the meantime, if you hear back from them let me know :)

    Oh, and just to be sure, have you tried the stock SSAO effect with this hair shader ? Is it working correctly ?
     
  20. Remiel

    Remiel

    Joined:
    Oct 17, 2012
    Posts:
    105
    I see. Thank you for your explanation. :)
    I replaced the quad with a circular mesh to avoid this issue.
     
  21. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    hi Chman,

    we've got a Unity 5 scene with forward rendering using SSAO Pro and have some shadows-only meshes that are getting their invisible meshes shaded with ambient occlusion. Obviously the shadow casters are writing to the depth buffer and ssao is using the depth buffer to determine the ao... is there any scene setup or magic shaders to render these shadows without the invisible shadow caster meshes rendering their ao?

    I've tried multiple cameras, hacked up some depth-only and shadow-collector shaders to try to layer the meshes and scene up correctly, but nothing has worked so far. It looks like the shadow collector shader stuff from Unity 4.x is deprecated (the shader source says it's only there to make older shaders compile), and I don't know enough about the current shadow rendering to know if there's a shader to capture just the shadows for a mesh which could be rendered from another camera or shader replacement trickery.

    Any ideas, or are invisible shadows-only meshes (either using the Unity 5 mesh renderer setting or using a custom shadows-only shader) not really possible?

    Thanks for any advice.
     
  22. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    AFAIK it's not really possible. I can think of one way (using shader replacement and tweaking the SSAO shader) but it's too expensive as it almost doubles the number of draw calls and eats more VRam, so it's definitely not worth it (unless you really really, and I mean *really* want it).

    This is unfortunately something SSAO is not really made for.
     
  23. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    No worries, Chman - thanks a lot for your reply. I thought I'd check to see if there was something obvious I was missing that might work around the issue, like multi-camera, a special shadow collector shader, or changing when the ssao shader ran during the rendering or something. It looks like ssao will have to go for this project...

    ps. I noticed the latest Unity 5.0.1p1 did an automatic script update on one of your v1.4 editor scripts as well - I'm sure you're probably aware, but thought I'd mention it just in case.
     
  24. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    I was not aware ! I'll look into it, thanks :)
     
  25. FamerJoe

    FamerJoe

    Joined:
    Dec 21, 2013
    Posts:
    193
    Hello Chman,

    Has anyone reported black dots when using your plugin on AMD Radeon based video cards on windows? Several of my users have reported them, and disabling SSAO pro fixes the problem.

    There's a couple of screenshots here when you can see them along the terrain:
    https://trello.com/c/QgMY3njt/114-dots-on-screen
     
  26. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Thanks for the screenshots.

    Yep, someone else had a similar issue with Radeons (R2xx serie). We could trace it back to the depth buffer precision going nuts in some cases but couldn't find a fix (driver bug, for some reason recent AMD GPUs aren't too fond of Unity). I also had reports of a very weird driver bug with downsampling (R2xx serie, once again).

    Unfortunately I don't have access to an AMD GPU right now so it makes debugging quite painful :(
     
  27. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    Using the SSAO pro (I just bought it) I am loosing the sort of shadows I got for the terrain's grass when using Unity Screen Space Ambient Occlusion. The following example is for a terrain without a lightmap.. Any suggestion? (Using Unity ver 5.01p2)
    SSAOPro.png
     
  28. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    That's definitely not normal. Could you post a screenshot of the AO pass ? (click the "Show AO" button)
     
  29. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    Here my situation (light deferred / gamma) :
    SSAOPro2.png
     
  30. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    I did some experiment and the problem is present also with lightmapping and with any kind of light (deferred etc.). To replicate the problem in Unity5 5.0.1p2 Windows 64:
    1. create a new project
    2. add the Environment standard asset
    3. Create a terrain with grass (I used GrasshillAlbedo for painting 2D and GrassFrond01AlbedoAlpha for the 3D grass)
    4. add SSAO pro
    5. add SSAO pro to the camera
    6. see the results
     
    Last edited: Apr 28, 2015
  31. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hello,

    It's not a bug, it's a limitation of the AO algorithm used in SSAO Pro. The grass is casting AO but it's definitely not as strong as the one the stock SSAO effect produces (btw, default settings aren't universal). SSAO Pro is mainly geared toward "geometric" sceneries (interiors, cities, anything hard-surfaced) where it's most likely to be used instead of natural landscapes (irregular terrains, thin grass blades, etc). It will, of course, work with them but the effect will look more subtle as you can see.
     
  32. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    Well..:(
    May I suggest you to include terrains for next versions?
    Thanks any way
     
    Last edited: Apr 28, 2015
  33. FamerJoe

    FamerJoe

    Joined:
    Dec 21, 2013
    Posts:
    193
    Hmp. It sort of makes the asset unusable since it ugly's up the screen of about 25%+ of the player base. So no fix or workaround in sight?
     
  34. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    I do have a workaround but it's ugly and quite expensive which makes it impractical for real world use. Obviously I'm looking into a proper fix :)
     
  35. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I'm getting a conflict with the UnoShader Unlit, it's showing up on top of the objects. This problem wasn't happening before unity 5.

    Screenshot:
    http://puu.sh/hGFrn/441c48d31f.jpg

    The AO from the floor behind the objects that are using the UNOShader are showing up on top of those objects :(

    Any ideas what I could look into to to fix this?
     
  36. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Which rendering path ? Deferred / Forward / Legacy Deferred ?
    What's the RenderType on the shader ? And RenderQueue ?
     
  37. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Tried with all of the rendering paths, same result.

    "RenderType" = "Opaque"
    "Queue" = "Geometry"
    "LightMode" = "ForwardBase"
     
  38. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Thanks. Out of curiosity, do you have the same problem with the default Screen Space Ambient Occlusion effect (from Unity's Effects package) ?
     
  39. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    http://i.imgur.com/BYD07Nh.jpg
    Here you can see a picture of the scene with Unity's AO, and a Show AO only to better see what is happening. Funny thing is that in Unity 4 it worked like a charm :( I guess something changed from 4 to 5 in that regard.

    I also sent a mail to the author of UnoShader asking about the problem to which he replied:

     
  40. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    It's hard to say if you get the same issue with Unity's AO because it doesn't capture small details (like in-between the tiles on the floor) so it doesn't really show in this case.

    SSAO Pro only makes use of the depth & normals buffers, like Unity's AO does. If you don't mind I'd like to check something... You'll find a package attached to this post, could you import it, disable the AO, put the NormalViewer component on your main camera and take a screenshot ? It's a small script I use to debug view-space normals, I just want to make sure the normals are correctly set before further investigations, thanks !
     

    Attached Files:

  41. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Normal viewer:
    http://puu.sh/hHjuU/6e27a954f2.png

    Added some cubes behind the plates with some really obvious AO to see if it would bleed in front of the plates using Unity's AO, definetly not bleeding D:
    http://puu.sh/hHjDH/583c89727d.jpg
     
  42. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hmm this is definitely weird (especially if it used to work with Unity 4). I'll contact the author of UnoShader and let you know !
     
  43. RodneyO

    RodneyO

    Joined:
    Jan 22, 2011
    Posts:
    50
    Hi Chman,
    Just sent you an email, I'm the author of UNOShader =)
     
  44. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Thank you both for the help :D Hope it's something easy to fix.

    Went back to a copy of the project I had that was still in Unity 4 to take a screenshot, this is what it used to look like before I made the upgrade to unity 5:
    http://puu.sh/hHsQ9/ae77a92ebd.jpg
     
  45. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hmm by the way, did you update the plugin when making the switch to Unity 5 ? SSAO Pro for Unity 5 isn't the same as SSAO Pro for Unity 4. It's a bit of a pain but that's the way the Asset Store works : if you want the Unity 5 version, you need to go to the store and re-download the package from Unity 5. If you downloaded it using Unity 4, you get the Unity 4 version.

    So if you haven't already done it : remove SSAO Pro from your project, go to the Asset Store and download / import SSAO Pro again, see if it makes any difference :)
     
  46. RodneyO

    RodneyO

    Joined:
    Jan 22, 2011
    Posts:
    50
    Hi guys I think I found the problem, the fallbacks on the new stuff in unity 5 includes Shadowcaster information stuff, which I'm assuming helps with normals and stuff.

    The fallback in UNOshader that I wrote doesn't have it. once I add the shadowcaster part, all works well again.

    So Dan for now download this
    www.unoverse.com/unoshader/fixes/fallbackUNLIT_1_3_fix.zip
    and replace the one in your directory ("UNOShader/Bin/Shaders"). I will update the asset store with a patch later on if this fixes the problem.

    Thanks guys =)
     
  47. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Yay! :D now it works! thanks a lot! both of you \o
     
  48. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Ah, glad to hear it's working :)

    @DanielSnd make sure you update SSAO Pro to Unity 5 !
     
  49. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I did :D
     
  50. RodneyO

    RodneyO

    Joined:
    Jan 22, 2011
    Posts:
    50
    awesome! use that update for now until I update the store.

    Chman that is one awesome tool btw!