Here is my Shader:
Shader "Shadow/ShadowMapping/ShadowMappingReciever_4" {
SubShader {
Tags { "RenderType"="Opaque" }
pass{
ZTest Always
ZWrite off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
//sampler2D _myShadow;
//sampler2D _myZDepth;
float4x4 _myShadowProj;
sampler2D _CameraDepthTexture;
float4x4 _CameraToWorld;
struct vertOut {
float4 pos:SV_POSITION;
float4 texc:TEXCOORD0;
float4 scrPos;
};
vertOut vert(appdata_base v)
{
float4x4 proj;
proj=mul(_myShadowProj,_Object2World);
vertOut o;
o.pos=mul(UNITY_MATRIX_MVP,v.vertex);
o.texc=mul(proj,v.vertex);
o.scrPos=ComputeScreenPos(o.pos);
return o;
}
float4 frag(vertOut i):COLOR
{
float d=tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD(i.scrPos)).r;
d=Linear01Depth(d);
return d;
}
ENDCG
}//endpass
}
//FallBack "Diffuse"
}
I think it should result something like this:
But it always result this:
What should i do,
here is the scene:


