Blur the alpha part of a shader

First I explain what I want to achieve. My goal is to get a soft shadow alternative running on iOS (because unity soft shadows does not work on this plateform).
I made a “transparentShadow” shader that is fully transparent but receive the shadow.
Here is what I get with my shader and hard shadow :


Here is my code :

Shader "Custom/Transparent-Shadows-blur"
{
	Properties
    { 
		// Shadow Stuff
		_ShadowIntensity ("Shadow Intensity", Range (0, 1)) = 0.6
		_ShadowBlur ("Shadow Blur",  Range (0, 0.01)) = 0.006  
    }
 
    SubShader
    {
	    Tags {
			"Queue"="AlphaTest" 
			"IgnoreProjector"="True" 
			"RenderType"="Transparent"
		}

		LOD 300
	
		// Shadow Pass : Adding the shadows (from Directional Light)
		// by blending the light attenuation
		Pass {
			Blend SrcAlpha OneMinusSrcAlpha 
			Name "ShadowPass"
			Tags {"LightMode" = "ForwardBase"}
			  
CGPROGRAM 
		// Upgrade NOTE: excluded shader from DX11 and Xbox360; has structs without semantics (struct v2f members lightDir)
		#pragma exclude_renderers d3d11 xbox360
		#pragma vertex vert
		#pragma fragment frag
		#pragma multi_compile_fwdbase
		#include "UnityCG.cginc"
		#include "AutoLight.cginc"
	 
		struct v2f { 
			float2 uv_MainTex : TEXCOORD0;
			float4 pos : SV_POSITION;
			LIGHTING_COORDS(3,4)
			float3	lightDir;
		};
	 
		float4 _MainTex_ST;
		sampler2D _MainTex;
		float _ShadowIntensity;
		float _ShadowBlur;		
	 
	 	v2f vert (appdata_full v){
	 		v2f o;
			o.uv_MainTex = TRANSFORM_TEX(v.texcoord, _MainTex);
			o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
			o.lightDir = ObjSpaceLightDir( v.vertex );
			TRANSFER_VERTEX_TO_FRAGMENT(o);		
			return o;
		}
	
		float4 frag (v2f i) : COLOR
		{	
			float atten = LIGHT_ATTENUATION(i);
			half4 c;
			c.rgb =  0;				
			c.a = (1-atten) * _ShadowIntensity;
			
			return c;
		}
ENDCG
  	}
  }
  Fallback "VertexLit"
}

I would like to blur the result of this shader to simulate soft shadows, in order to have this kind of result :

I have read a lot about blur techniques shader. But it only blur the texture (like this Distance Blur Shader for Texture « Unity Coding – Unity3D).

But I don’t achieve to blur the alpha part.

Any idea please?

Any one can help me please ?

If you go to your Unity installation folder, and then to Editor/Data/CGIncludes, you should be able to see how LIGHT_ATTENUATION is defined in AutoLight.cginc. It samples the lightTexture once, at the given uv coordinate (the exact implementation depends on the type of light that is used.)

You could try to create your own version of LIGHT_ATTENUATION(), that samples the LightTexture from multiple positions around the given uv, similar to the blur example you linked to.

Thanks a lot. I’ll try tomorow and I’ll let you know about it.