Unity SSAO effect renders over object.

Alejandro 3 months ago • updated by Ryan Gatts 3 months ago 6

I'm on Unity 2017.1.1f1 and SF v1.38

The shader looks fine, but as soon as I enable AO in the post process profile I can see the effect being rendered over the mesh (goes back to normal if you disable it). 

It only happens with Unity's SSAO.

Any kind of info on how to avoid this would be greatly appreciated.

Can you include an image of the result? You may just need to let your shader write to depth if it isn't.

Hey there, thanks for the reply.

Here's a comparison with SSAO turned OFF (left) and ON (right).

I'm not sure how to let my shader write to depth, is that on the Blending options?

sorry for the slow reply, masked materials should draw to depth -- as should anything in the deferred pipeline.

Sorry for the noob question, but how do I make the shader write to depth?

I've been able to fix the issue by making sure the shader is set to deferred instead of forward on the lighting panel.

You may close this ticket now.

sorry for the slow responses on my part. I actually don't know how to make a shader write to depth while in the SF interface. I have only ever solved this by including this in a shadow pass (since an object needs to write to depth in order to cast a shadow) or by setting a default fallback shader that has a shadow pass in it. I don't suppose that helps you much though. Glad you got it working