Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Ambient Occlusion Post processing not affecting transparent objects.

Discussion in 'Graphics Experimental Previews' started by Atlantiss, Nov 18, 2018.

  1. Atlantiss

    Atlantiss

    Joined:
    Aug 5, 2018
    Posts:
    14
    I was using a transparent lit shader for a masked material and ambient occlusion effect is not working on the opaque area of the masked material.
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's correct. AO is a depth based effect and transparent does not write to depth. Same for DOF etc...

    It could be possible if another shader in opaque writes to depth just before transparent, and transparent then draws if depth is very close (like a decal).
     
  3. Atlantiss

    Atlantiss

    Joined:
    Aug 5, 2018
    Posts:
    14
    Is it possible for the transparent material to write to depth by changing any properties?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    No. But you can draw a mesh that writes to depth beforehand.
     
  5. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    229
    Hello, is there any way to prevent AO from drawing on transparent parts of cutout shader? Here is what my problem looks like:
    Screenshot_270.png
     
    Last edited: Dec 5, 2018
  6. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    229
    Perhaps the Ambient occlusion is not on the model itself, but is showing up on the model from the Ambient Occlusion applied to the mesh behind the model. This would explain the darkness only where the ground is behind the character.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unfortunately the transparent parts of a cutout shader aren't really transparent but opaque... so not sure what you could do to fix this. Perhaps Unity staff would know. Make sure the shader using cutout properly discards before writing depth, or if there is a depth pass being done make sure the same cutout runs on that.
     
  8. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    229
    Alright, the problem is fixed, for now at least. Of course I would be getting errors if I had the occlusion settings set to Force FORWARD Compatibility while I am on deferred rendering. Thank you for your help.
     
  9. Mihajilovski

    Mihajilovski

    Joined:
    Feb 22, 2018
    Posts:
    1
    Hello, chadfranklin47, can you please share how did you fix AO problem? Thanks!
     
  10. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    229
    I had the Force Forward Compatibility option ticked while I was using deferred rendering. I just unticked it and everything worked correctly.