problem with custom terrain shader (added holes-functionality, problem with some post effects)

I wanted holes in my terrain, so I modified the terrain shader (firstpass shader) to allow this, I simply made 1 of the splats be used for clipping. Then I added a ShadowCaster subshader so it would render shadows correctly (I do the same clipping there).

It all seemed to work, until I used screen space ambient occlusion or obscurance, these effects behave as if the terrain is still completely opaque (no holes).

So it seems to me as if the depthbuffer or normalbuffer is somehow incorrect, which I find strange as everything (apart from these post effects) is all still correctly rendered.

I’m using deferred in Unity5

any ideas?

//added this in the surface shader
clip (0.2-splat_control.a);
//added this at the end to get correct shadows:
SubShader
     {
         // Pass to render object as a shadow caster
         Pass
         {
             Name "ShadowCaster"
             Tags { "LightMode" = "ShadowCaster" }
        
             Fog {Mode Off}
             ZWrite On ZTest LEqual //Cull Off
             //Offset 1, 1
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             #pragma multi_compile_shadowcaster
             #include "UnityCG.cginc"
             struct v2f
             {
                 V2F_SHADOW_CASTER;
                 float2 tc_Control : TEXCOORD4;
             };
            
            sampler2D _Control;
            float4 _Control_ST;
             v2f vert( appdata_base v )
             {
                 v2f o;
                 o.tc_Control = TRANSFORM_TEX(v.texcoord, _Control);
                 TRANSFER_SHADOW_CASTER(o)
                 return o;
             }
             float4 frag( v2f i ) : COLOR
             {
                 half4 splat_control = tex2D(_Control, i.tc_Control);
                 clip (0.2-splat_control.a);
                 SHADOW_CASTER_FRAGMENT(i)
             }
             ENDCG
         }
     }

Change your terrain shaders RenderType to TransparentCutout
EDIT: although that is not enough itself, there also should be a _Cutout and a _Color property involved in your clipping.

You can indeed use the _Cutout property (in combination with setting the alpha correctly for that) instead of doing the clipping manually, but it gives the same result and doesn’t fix the problem with the post-effects.
Changing the rendertype doesn’t seem to do anything.
I don’t see how using a _Color property would solve anything?

If you check the internal render-depthnormals replacement shader, TransparentCutOut is calculated via clip(col.a * _Color.a - _Cutout);