Post processing AO render on top of mesh

callebo_FK 3 months ago 0

I am making a shader with custom lighting which has cutout transparency. The problem I am facing is the ambient occlusion from objects behind my custom shaded object is rendered in front:

The selected object has the AO from the wall behind it rendered on top, like if it was transparent.

The only way I seem to be able to "fix" this is by either making the shader render path deferred, but this forces me to use PBL light mode, or setting blending order to Transparent (3000) or higher, but then the object itself doesn't render any AO at all.

Does anyone have any idea how to fix this? So the object doesn't render AO from objects behind it, but still renders its own AO.