8,325
社区成员




Shader "MyShader/3-2-2" {
Properties {
_MainTex ("Base (RGB)", 2D) = "" {}
_BlurTex ("BlurTex (RGB)", 2D) = "" {}
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct OutPut {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
//float2 uv2 : TEXCOORD1;
};
sampler2D _MainTex;
sampler2D _BlurTex;
float4 _BlurTex_ST;
sampler2D _CameraDepthTexture;
OutPut vert (appdata_img v)
{
OutPut o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = v.texcoord.xy;
//o.uv2 = TRANSFORM_TEX (v.texcoord, _BlurTex);
return o;
}
half4 frag (OutPut o) : COLOR
{
half4 color = float4(0,0,0,0);
half4 depth = tex2D (_CameraDepthTexture, o.uv);
if(depth < 0.5)
color = tex2D(_MainTex, o.uv);
else
color = tex2D(_BlurTex, o.uv);
return color;
}
ENDCG
}
}
Fallback off
}