Search Unity

SSAO Pro - High Quality Screen-Space Ambient Occlusion

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

  1. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    The test project was in 5.2.2p3, upgraded to 5.3.6, then to 5.4.0p3, and finally to 5.4.0p4. I don't know if it happened on 5.4.0p3.
     
  2. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Ok so I did some tests on multiple scenes and I'm not able to reproduce this issue (tried on a GTX980, GTX1070 and R9 370X). Would you happen to have a small repro case you could share ?

    Also, I would highly recommend that you update to SSAO Pro 2, especially if you're working in Unity 5 as I fixed a few bugs and improved the quality.
     
  3. shawnblais

    shawnblais

    Joined:
    Oct 11, 2012
    Posts:
    324
    Any chance of adding support for Single Pass Stereo rendering in VR? Also performance in general is pretty poor in VR, it seems all SSAO solutions suffer from this, which is a shame because it really helps increase immersion inside the headset.
     
    Last edited: Sep 8, 2016
  4. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    That would be nice indeed, but I don't have a VR headset at home so I need to get a hold on one first. But as soon as I do then yes, I'll add single pass stereo rendering support to SSAO Pro !
    Yeah unfortunately the cost of [insert anything here] goes up with VR due to the target resolution, framerate and the fact that you have to do stereoscopic rendering... IMO, I have good hope it'll improve in the future thanks to techniques like multi-res shading, fovated rendering and the likes. I guess time will tell.
     
  5. shawnblais

    shawnblais

    Joined:
    Oct 11, 2012
    Posts:
    324
    True, all effects are a little more expensive in VR, but with AO in particular it's proving to be a real struggle to find one that looks good and doesn't crush the framerate :(
     
  6. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    That's because AO itself is a conceptually expensive effect if you want it to look good enough to be usable. Some effects like AO, SSR and such are more expensive because of the complexity of the maths involved. In the case of AO it will also rely a lot on cache hits (see this reply I made earlier about that). So... Yeah, it's hard to find an AO algorithm that runs very fast without impacting its visual quality :)
     
  7. ChillX

    ChillX

    Joined:
    Jun 16, 2016
    Posts:
    145
    Just trying to run the demo scene in Unity 5.4.1f1
    Graphics card NVidia 970
    Error Message:
    Unsupported shader (SSAO).
    UnityEngine.Debug:LogWarning(Object)
    SSAOPro:OnEnable() (at Assets/SSAO Pro/Scripts/SSAOPro.cs:148)
    UnityEditor.DockArea:OnGUI()​
     
  8. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Most likely the shader failed to compile because it couldn't find the CG include file which is in the same folder. Look for the /SSAO Pro/Resources/ folder in the Project panel, right click on it and choose Reimport. That should fix it. It happens sometimes when Unity fails to import a package properly for some reason.
     
  9. ebanimations

    ebanimations

    Joined:
    Apr 10, 2013
    Posts:
    7
    Getting a similar issue here with a series or errors
    Shader V2 (on reimport)
    Error:
    Followed by a series of these errors referencing different lines:
    Shader V1 also contains this error:
    Any help please, where you able to fix this before? We have tried multiple re-imports but no joy.

    We're using Unity 5.3.6p2 (64bit)
     
  10. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Can you make sure the file SSAOPro.cginc exists in the project and is next to SSAOPro_v2.shader ? They should be in /SSAO Pro/Resources/.
     
  11. ebanimations

    ebanimations

    Joined:
    Apr 10, 2013
    Posts:
    7
    Hi yes I can confirm that the file exists and is in the Resources folder next the shader. I can fix the missing cginc file by adding the full file path in the shader but im still getting this error.
    *update*
    For now we have patched this by adding the full .cginc file path to all references in the both shaders and commented out the bilateral smoothing pass in the shader (pass No. 6)

    also I have tried this with the latest version of Unity but still get the same issue. is anyone else seeing this or is a local issue to us?
     
    Last edited: Oct 24, 2016
  12. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    I tried it on 5.3.6 and 5.4.1, I couldn't reproduce the error :/

    Out of curiosity, what's your target platform ?
     
  13. ebanimations

    ebanimations

    Joined:
    Apr 10, 2013
    Posts:
    7
    Our target platform is Android but I have also tried it with PC Standalone. Maybe this issue is our end I'll have a deeper look into it and let you know if I find anything of interest.

    thanks for your support :)
     
  14. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    On the issue of performance drops when too close to a wall or big object (didn't think cache misses would be so expensive, the frame time of the SSAO goes from 10-15% to around 50-60%!), we've done the following change in the shader:

    Code (csharp):
    1.  
    2. half radius = clamp(_SampleRadius / eyeDepth, 0.005, 0.05);
    3.  
    If I'm correct, this clamps the sample distance to 5% of the screen, which is enough to avoid performance drops on 1080p and there's no noticeable difference on our game.
     
  15. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    Hi,

    I'm using 5.4.3 and can't get this to work with single pass stereo. I get a bunch of messages in the console:
    https://i.gyazo.com/aec7fb9108485dd0b5c255b9848e6852.png

    All I'm doing is adding SSAO Pro to a camera in an basically empty scene with single pass stereo enabled. (Deferred, linear.)
     
  16. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hi, did you update to the latest version (2.1) ? I pushed an update for single pass stereo rendering
     
  17. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    I'm using the latest available package in the asset store (2.1).

     
  18. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hmm indeed, looks like there's an issue in 5.4 (I tested single pass stereo in 5.5). I'll look it up and issue a patch, thanks for the report !
     
    SunnySunshine likes this.
  19. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    Thanks.

    While you're at it... I'm not sure if it's fixable, but another issue is that it doesn't seem like the new post processing effects play nicely with ssao pro. It's as if the AO gets inverted or something.
     
  20. Safemilk

    Safemilk

    Joined:
    Dec 14, 2013
    Posts:
    42
    What SunnySunshine said! I included a needlessly large shot of it, hopefully it helps! Unity Version 5.5.0 b11 AO_bug.jpg
     
    Last edited: Nov 28, 2016
  21. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Do you happen to be working with the Forward rendering path and have MSAA enabled ?
     
  22. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    I'm not sure about his case, but just to show you the problem I'm having.

    Here's what it looks like with both enabled:


    If you disable post processing, it still shows shadows in a weird fashion:


    If you disable both behaviours and then just enable ssao pro, then it displays correctly:


    (And just for reference, this is what it looks like w/o anything.)

    My settings


     
  23. Safemilk

    Safemilk

    Joined:
    Dec 14, 2013
    Posts:
    42
    Negative, I'm using deferred and have MSAA off all the way.

    I am using the DirectX11 pipeline though. Pretty much identical to SunnySunshine's settings.
     
  24. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    Unity 5.5 final just released. I tried out SSAO Pro with single pass stereo rendering and am still getting a double vision issue, so the plugin is not compatible with it

    I'm using it in an empty scene using the SteamVR plugin
     
  25. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    @SunnySunshine @Safemilk @Carpet_Head
    I just pushed an update (version 2.1.1 - changelog) to the store, it will be up soon. It should fix single/multi pass stereo rendering and compatibility with the post processing stack (tested with Unity 5.4.0 and 5.5.0). Let me know how it goes.
     
    SunnySunshine likes this.
  26. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    I want to make a request to bring back the Bilateral blur filter to the latest version of the plugin.

    It may not look as smooth or pretty as the other ones, but at the very least it doesn't show seams like the other two, which is a huge plus for us (our game is dark so any seam is very noticeable).

    I always have to edit the updated versions to add the old filter, so it would be better if we didn't need to.

    As a quick sample of what I'm telling:

    No Blur:


    Bilateral blur:


    HQ Bilateral and Gaussian (notice the seams in the right arm):



    The smoother the blur, the more evident these seams are.
     
  27. Safemilk

    Safemilk

    Joined:
    Dec 14, 2013
    Posts:
    42
    Reporting back, your fix worked, no more conflict on my end with the post processing chain. Thanks!
     
  28. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    The fix appears to work in the editor, but when I go to make a build, i still get a weird flickering effect. I appreciate that without the hardware this might be hard for you to solve. Let me know if there is a way I can help you with this
     
  29. John3D

    John3D

    Joined:
    Mar 7, 2014
    Posts:
    441
    Nice asset. Just discovered it.
     
  30. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm having trouble with SSAO Pro and Speedtree, see screenshot. This is in forward rendering. I went to the page linked from a reply about a similar issue on the previous page of this thread, but it didn't seem to apply. Is there a way to get SSAO Pro and Speedtree to work well together?
     

    Attached Files:

  31. androidunity

    androidunity

    Joined:
    Oct 25, 2012
    Posts:
    3
    Can not work with ValveCamera of "TheLabRenderer", link: http://u3d.as/tNq
    Please fix.
     
  32. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    Hello I would like to ask you if it is possible to attach ssao script somehow to work with camera.render(); function. It is necessary that I am baking objects into textures and then I get absolutely different results. And found that results are in ssao... Thanks for response in advance
     
  33. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @Chman I'm getting these errors when doing a Standalone build:
    Do you know what would be causing these errors?
     
  34. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
  35. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi,
    I'm having issue with the asset when I build to android. It's working fine in the editor, but on device it looks like this:



    Thanks!
     
  36. gamers2000

    gamers2000

    Joined:
    Jan 13, 2017
    Posts:
    5
    Hiya -
    SSAO Pro worked beautifully until we tried adding decals. When the decal system (store link) and SSAO Pro are both enabled, it appears as though the AO reads from one of the color buffers instead (note the presence of the shadow in the AO buffer with decals enabled).

    Any idea why this would be happening? Any guesses would be great. Thanks!

    upload_2017-1-20_15-56-45.png

    upload_2017-1-20_16-3-10.png
     
  37. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    surely is. As it reads depths from objects behind ;) I had a problems with depth too on two sided materials, but author helped me to solve. No clue about gpu meshes thought...
     
  38. JesseCarpenter

    JesseCarpenter

    Joined:
    Nov 7, 2013
    Posts:
    5
    Hi! I've been using SSAO Pro on our game project for a while now, and it has worked really well. It seems however, to be having some issues since we updated to 5.5.0f3. It is no longer shading in corners of geo as it should but is covering the most of the screen and shading objects in more of a 3D way. Are you aware of any known issues with the newest version of Unity?
     
  39. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    I had same issue after upgrading unity... but found I did not have actual version of SSAO - it fixed.
     
  40. SoyUnBonus

    SoyUnBonus

    Joined:
    Jan 19, 2015
    Posts:
    43
    Is there any way to ignore certain objects (or a full layer) when dealing with the AO?

    It's pretty hard to blend the grass with the terrain in a nice way.
     
  41. vice39

    vice39

    Joined:
    Nov 11, 2016
    Posts:
    108
    Would this work on objects with transparent materials ?
     
  42. svaldenegro

    svaldenegro

    Joined:
    Feb 22, 2014
    Posts:
    26
    Hey I have a question. how could i use it two deferred cameras as example for a FPS.
    The SSAO doesn't work when i want to render the background (the first renderized Camera).

    More info using 2 deferred cameras:
    If SSAO is on Camera layer 0 the effect doesn't work.
    If SSAO is on Camera layer 1 the effect just work to what is rendered in the Camera.
     
  43. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Just updated to 5.6f3 Got this error. Any tips?

    Shader error in 'Hidden/SSAO Pro V1': Did not find shader kernel 'vert_bilateral' to compile (on d3d11)

    Compiling Vertex program with HIGH_PRECISION_DEPTHMAP_ON
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA
     
  44. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Ouch sorry about the late reply, somehow I missed all of these and the forum notification system messed up.
    Apparently there's a bug with Camera.Render() not rendering image effects properly.
    Would you happen to have more information about this? If it's a shader compilation error you should see it in the inspector for the ssao shader.
    Most likely, yes. SSAO Pro uses the depth & normal buffers to get the info it needs. That's all it uses, so if the source information is incomplete...
    SSAO Pro relies on the depth & normal textures to be available and properly bound when it executes (which is handled by the engine itself). It seems to me that this decal asset is either doing something it shouldn't do or it does something that should be legal but breaks in the engine. It's hard to say, really.
    No, because transparent materials don't write to depth.
    Not really, no, there isn't any easy and cheap way to exclude (or include-only) objects from the AO pass because of the depth & normals buffers
    I think there was a bug with Unity + deferred + image effects + multi camera setup. Have you tried in 5.6 ? It should be fixed.
    Right-click the SSAO Pro folder in your project panel and choose "Reimport", that should fix it.
     
  45. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    We submitted some bugs around multi-camera and deferred rendering a while ago. They were eventually closed as duplicates a while ago, but the duplicate issue appears to still be open. This might be related to these SSAO Pro image effects problems.

    Our closed issue: #835332 "Deferred rendering path does not support 'Clear Flags: Don't Clear" - showed rendering problems compositing multiple deferred cameras with no effects being used.

    Active issue: https://issuetracker.unity3d.com/is...s-of-two-cameras-is-rendered-completely-white

    Edit: I can confirm that our original issue still isn't working in Unity 5.6 - compositing multiple deferred cameras does not work.
     
    Last edited: Apr 3, 2017
  46. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi greg,
    would you so kind and query me the example "Deferred.zip" from the bug report you have posted?
    I really like to have look on this and compare it with my settings.
    Thank you.
     
  47. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    Sure - have pm'd you the link :) Let me know how you get on with it.
     
  48. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    I'm having some problems in unity 5.6 with SSAO Pro. My setup is this:

    SteamVR application (Forward Rendering, Single and Multi Pass Stereo Rendering)

    Secondary camera that follows the user's movements but renders to the main display of the computer, rather than VR

    With SSAO Pro disabled, the secondary camera seems to render normally.

    With it enabled, the image is inverted, but the SSAO effect is in the correct orientation

    Here is a screenshot:

    http://puu.sh/vbqSw/3c159c2043.jpg

    Any idea what might cause this? Thanks!
     
  49. jordys

    jordys

    Joined:
    Oct 31, 2016
    Posts:
    1
    We have this exact same problem on Unity 5.6.0f3 with SSAO Pro 2.1.1, but only using one camera that switches between normal and VR with a key on the keyboard.

    The game starts in normal mode and everything is fine. We switch to VR and everything is still fine. When we switch back to normal however, the camera image is inverted and SSAO is in correct orientation. Everytime we make the switch after that, VR is fine, normal is incorrect. For now we are thinking of compiling two separate versions: One for normal use and one for VR use.
     
  50. Shtrude1

    Shtrude1

    Joined:
    Nov 5, 2016
    Posts:
    15
    Hi,
    I have an issue where after certain amount of distance with a camera i get these tearing black lines
    Image 1 - is where camera is set to x 0 y 0 z 1000
    Image 2 - is where camera is set to x 0 y 0 z 0
    Iam using Unity 5.6.0
     

    Attached Files: