Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Ambient occlusion not working with transparent material

Discussion in 'High Definition Render Pipeline' started by BlueBossa25, Jan 20, 2020.

  1. BlueBossa25

    BlueBossa25

    Joined:
    Aug 17, 2017
    Posts:
    2
    Unity Version : 2019.2.17f1
    HDRP Version : 6.9.2

    Hey, I'm trying to get that sweet HDRP ambient occlusion working with my custom terrain system. My terrain is a single mesh object, rendered with a single transparent material. The material has a tileset texture with alpha used for clipping. Shadows are cast correctly by the clipped sprites used from the texture. I know ambient occlusion must work, because I have been using ambient occlusion in a previous unity version with the exact same mesh/texture with the help of unity's Post Processing Stack https://docs.unity3d.com/2018.3/Documentation/Manual/PostProcessing-Stack.html

    Now I'm just trying to do the same with the HDRP mode.
    Here is a screenshot of the problem :

    Intersections of walls and floors are supposed to be darker. You can clearly see the difference between AA ON/OFF on the right. I rendered both side by side in the example project for this comparison. From what we see, AA is supposedly configured to be visible on both objects but its not the case.

    Here is an example with an older version using unity's Post Processing Stack.

    Intersections for walls and floors are darker here.

    I tried :
    • Switching form Forward Rendering to Deferred Rendering (and vice versa)
    • Unchecking / Checking - Transparent Prepass
    • Unchecking / Checking - Transparent Postpass
    • Unchecking / Checking - After Postprocess
    • Playing with Prepass/Postpass Clipping thresholds
    • Using the demo project with everything configured
    • And other options which I don't particularly remember
    Here is my global configuration :


    And here is my material configuration :


    Thank you for your time!
    Looking forward for all your recommendations :) !
     
    Last edited: Jan 20, 2020
    andywatts and Just4lol like this.
  2. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    Hi,

    I am supposing you make confusion here as SSAO from Unity don't work with Transparent (either HDRP or postprocess stack). Transparent don't work in the depth buffer which is used in SSAO (even in HDRP if you check depth prepass for transparent, it is too late to be consider part of SSAO).

    My guess is that you make confusion with alpha clipping maybe? In HDRP both opaque and transparent support alpha clipping, this is maybe what confuse you? Try to switch to opaque surface and keep alpha clipping enabled and you will get your result.

    hope this help.
     
  3. BlueBossa25

    BlueBossa25

    Joined:
    Aug 17, 2017
    Posts:
    2
    It did help.

    As you stated I was confusing the Transparent Alpha Cutout with the Opaque Alpha Cutout. After fixing the problem and playing with the SSAO a bit I however saw they changed the algorithm for something more realistic as I cannot get the same results as I would have with the old Post Processing Stack SSAO.

    I read somewhere it has something to do with with latest version of HDRP using Ground Truth Ambient Occlusion, do you know if that's the case? Anyway that main problem of my thread has been fixed, thanks!
     
    laurent-h likes this.
  4. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    Yes, we have switch to GTAO to get more detail and also take into account normal. But you can still play with the parameter to increase radius (but you will indeed not be able to achieve the exact same look)