Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. 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

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
    The amount of keywords used by SSAO Pro will be reduced in the next update. This limitation is annoying :/
     
  2. EdwinPC

    EdwinPC

    Joined:
    Nov 25, 2014
    Posts:
    6
    Hi Im tempted to buy your post processing effect, It really looks nice, but I would like to know if you can use layers to exclude lets say: static objects and only use it for the dynamic ones. is it possible>?
     
  3. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hello,

    No, it's not possible right now. Although you could do it using a two cameras setup - but for some reason I could only get it to work with the deferred rendering path.

    I plan to add this feature to the asset in the future (no ETA yet).
     
  4. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    I noticed that unity5 has 2 different AO. Whats the difference between them and whats the difference between your package?
     
  5. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Unity 4 have both of them too :) The difference has to do with the technique used to compute the ambient occlusion factor for each pixel (plus speed and quality). Take a look at the first post in this topic, I added a few comparisons with Unity's SSAO.
     
  6. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    yea but which of unitys ssao did u compare with? i hear the newer one is faster and looks better
     
  7. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    The Ambient Occlusion one. I couldn't get the last one, "Ambient Obscurance", to look good. It looks even worse than the original one IMO.
     
  8. EdwinPC

    EdwinPC

    Joined:
    Nov 25, 2014
    Posts:
    6
    Alright so if you planning to add this feature in a near future I will go ahead and get it, I already got your colorful effects and I m quite happy with the performance and quality. I hope you dont forget about this post ;)
    thx
     
  9. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,753
    Will this asset support Unity 5?
     
    Jaqal likes this.
  10. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Yes. It's already being used with Unity 5 and I'll make sure it still works with it once it's out of beta (things may break during the beta cycle).
     
  11. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    717
    Saw that you were thinking about putting in some different algorithms in the future, I've just seen this one: http://graphics.cs.williams.edu/papers/SAOHPG12/ which looks pretty interesting (if you don't know about it already).

    Edit: Whoops, Unity already uses this method.
     
    Last edited: Dec 10, 2014
  12. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    isnt this the ambient obscurance unity already has? They have ambient occlusion and another one for ambient obscurance i thought.
     
  13. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Yes, it's the same one. It's an interesting technique that works fine with high radius AO but not so much with low/medium radius IMO. That's the problem with screen space AO, it's very scene dependent, some techniques will work better than others (high details vs low details environments, cartoon vs realistic rendering, etc).
     
  14. Mordakie

    Mordakie

    Joined:
    Apr 17, 2013
    Posts:
    13
    Is this plug-in not compatible with Skyshop?

    Currently when I add SSAOPro to a camera it the script is auto-disabled. If I enable it, the whole screen turns black and flashes pink when I move around in the environment.
     
  15. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    It is.

    SSAO Pro disables itself if one of the following is true :
    • Image effects aren't supported.
    • Render Texture aren't supported.
    • The shader isn't supported by your GPU or the target platform.
    Could you check the following ?
    • Any error in the console ?
    • Make sure Graphics Emulation is not set.
    • What is the Platform set in Build Settings ?
    • Do you have Unity Pro ?
     
  16. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Some news about the next update :

    I fixed a view space bug (in some cases the AO contribution would act in a weird way, a bit like a specular effect). More importantly, the effect won't have any more restriction regarding the camera near/far clipping planes ! Oculus Rift owners will be glad :)

    I still need to fix a few things but version 1.2 should be up soon.
     
    GoGoGadget likes this.
  17. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    717
    Ah, that camera clipping plane fix is awesome. Looking forward to it.
     
  18. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    I jus bought it for the support of the fog because while unity SSAO is ok to my liking the fog issue is killing me, being able to have a falloff is awesome. VR support is also great.
     
  19. Jaqal

    Jaqal

    Joined:
    Jul 3, 2014
    Posts:
    288
    Just bought this and I am getting this error "Maximum number (64) of shader keywords exceed" 4 times and I cannot get this effect working at all. I am using Unity 4.6 Pro and Lux PBS. I'm guessing it has something to do with Lux but I am hoping they can work together.
     
  20. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,048
    When I use this on the Unity 5 my objects become see through
     
  21. Jaqal

    Jaqal

    Joined:
    Jul 3, 2014
    Posts:
    288
    I'm not sure if this is getting support anymore...
     
  22. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,044
    Why do you say that?
     
  23. Jaqal

    Jaqal

    Joined:
    Jul 3, 2014
    Posts:
    288
    Bc it's been over two weeks since the last comment from the author... Maybe he's taking a break.
     
  24. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,044
    Well it is the holidays, so......... maybe a more logical assumption is that he's on holidays?

    Certainly a better assumption then making comments that the product isn't being supported anymore.
     
  25. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    717
    That's a Unity limitation, which can be worked around. Unity 4 only allows for a max of 64 shader keywords, unfortunately there's no way of checking how many you have at any given time either.
    What you can do for SSAO Pro is remove some of the keywords you don't need - eg. if you don't need to change the occlusion color, that's a keyword saved (just comment out any references to it in the shader). Lux uses tons of keywords as well, as do some image effects. It's worth going through and taking the ones you don't need out anyway.
     
  26. Jaqal

    Jaqal

    Joined:
    Jul 3, 2014
    Posts:
    288
    Thanks for the reply. I tried importing several times and it always seems to show four keyword errors. I can script fairly well but have never messed with shaders. I only use a couple Lux shaders anyway. Is there an easy way to spot when a keyword is being used in a shader script?
     
  27. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    717
    Just pm'ed you an example, but in SSAO Pro, the custom occlusion color option is defined like this (which uses 2 shader keywords):
    #pragma multi_compile CUSTOM_COLOR_ON CUSTOM_COLOR_OFF
    Comment it out everywhere in the shader, make sure you fix any #if/#elif's referincing those keywords in the rest of the shader. Also, there are quite a few other forum posts on it, just google "Unity remove shader keywords" or something similar.
     
    Chman likes this.
  28. Jaqal

    Jaqal

    Joined:
    Jul 3, 2014
    Posts:
    288
    Awesome, got your pm. Thanks for taking the time to explain that. I was pretty bummed when it wouldn't work with Lux but now I have a chance!

    Unity should have a feature that shows keyword useage. Someone could sell that on the asset store...
     
  29. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Sorry about the long wait, between Christmas holidays and my internet going down, I've been quite busy ! The plan was to release SSAO Pro 1.2 before Christmas but it took longer than expected. It's still coming, very soon.

    The maximum number of shader keywords is an unfortunate limitation (apparently they bumped it to 128 in Unity 5). For what it's worth, version 1.2 will save two more keywords, bringing the requirement down to 10. I could remove all the keywords and use shader passes instead but it would make the code harder to maintain in the long run. I'll see what I can do in future versions, as this error is quite annoying to me too.
     
  30. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,202
    I just read about some fixes on Shader keywords in the b18 release notes, maybe it helps
     
  31. Chman

    Chman

    Unity Technologies

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

    Changelog (1.2) :
    • Added : A new, more predictable SSAO variant. This one doesn't depend on the clipping planes and fixes a few self-shadowing bugs. The old SSAO is still available (use the "SSAO Mode" dropdown).
    • Modified : The old SSAO mode "1.1 (Legacy)" now uses a higher precision depth map and works better with the forward rendering path.
    • Modified : Distance cutoff is now always enabled, bringing the "shader keywords" requirement down to 10.
    • Modified : The default noise texture is now automatically applied on creation.
    • 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 re-import the last version.
     
  32. JeyDia

    JeyDia

    Joined:
    Feb 14, 2013
    Posts:
    100
    Last edited: Jan 13, 2015
  33. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Sorry about that, I'm pushing an update as we speak to fix this !
     
  34. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hotfix 1.2.1 !

    Changelog (1.2.1) :
    • Fixed : No more HideFlags errors on build.
     
  35. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    New hotfix !

    Changelog (1.2.2) :
    • Fixed : Transparent objects aren't affected by the ambient occlusion anymore.
     
  36. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    As in they dont darken? or they dont have AO that comes from the things behind them?
     
  37. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    As in they don't get AO on them and they don't cast AO. But you'll see the AO behind them if there's any. The AO pass is rendered after opaque geometry but before transparent geometry.

    It was already like that in SSAO Pro pre-1.2 but somehow I broke it in 1.2. It's now back to the original behavior.
     
  38. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    What about "cutout" version of transparency?
     
  39. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    It's a special case, it will get AO. Same with trees, grass, and the likes :)
     
  40. alllen

    alllen

    Joined:
    Aug 14, 2012
    Posts:
    13
    Doesn't seem to work on Unity 5 b18. Not even the 1.1 Legacy mode, have to revert back to the actual 1.1.

    I'm getting this Unsupported shader (DepthNormal) message. No matter which render I use (deferred, legacy deferred, forward, etc) it does this.
     
  41. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Thanks for the feedback. I can't officially support Unity 5 because it's still in beta, but I'll look into it anyway and hope that whatever fix I come up with won't get nuked by a future beta update... I'll get back to you soon.
     
  42. EdwinPC

    EdwinPC

    Joined:
    Nov 25, 2014
    Posts:
    6
    Hi Chman
    I bought your post effect and Im quite pleased about it, just one quick question to bump again into the subject ...are you planning to work on layers exclusion?? .. hope you can give a go on that feature.
    thank you!
    E.
     
  43. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Yes that's a feature I'd like to add at some point, if I can manage to do it correctly. I'm still looking for a good way to approach it as it's definitely not easy to implement in this case...
     
  44. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    UT did some refactoring with their CG include files in Unity 5. Code-wise it's an easy fix, but it means I have to do a Unity 4 and a Unity 5 version... I don't want to have two separate packages so I'll find a way around that. In the meantime, check your PM's !
     
  45. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,102
  46. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    These are script defines, unless I'm mistaken version defines don't work in shaders. I'll bundle both shaders and choose the correct one from script. I don't like the idea of duplicating a shader file with minor changes but I don't think there's a better way to do it in this case.
     
  47. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    388
    Hey Chman, I'm having the same issue (5.18) could I get that also thanks
     
  48. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Check your PMs !
     
  49. DeveloperRLA

    DeveloperRLA

    Joined:
    Jun 17, 2013
    Posts:
    53
    Chman, I'm having the same issues with 5 b 20. Could I also please get your 5 version? Thanks a lot!
     
  50. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Check your PMs !
    I'll also push the fix to the Asset Store in a few hours.
     
unityunity