您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

120 行
2.0 KiB

Shader "Hidden/MotionBlur" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_AccumOrig("AccumOrig", Float) = 0.65
}
SubShader {
ZTest Always Cull Off ZWrite Off
Pass {
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
BindChannels {
Bind "vertex", vertex
Bind "texcoord", texcoord
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD;
};
float4 _MainTex_ST;
float _AccumOrig;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
sampler2D _MainTex;
half4 frag (v2f i) : SV_Target
{
return half4(tex2D(_MainTex, i.texcoord).rgb, _AccumOrig );
}
ENDCG
}
Pass {
Blend One Zero
ColorMask A
BindChannels {
Bind "vertex", vertex
Bind "texcoord", texcoord
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD;
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
sampler2D _MainTex;
half4 frag (v2f i) : SV_Target
{
return tex2D(_MainTex, i.texcoord);
}
ENDCG
}
}
SubShader {
ZTest Always Cull Off ZWrite Off
Pass {
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
SetTexture [_MainTex] {
ConstantColor (0,0,0,[_AccumOrig])
Combine texture, constant
}
}
Pass {
Blend One Zero
ColorMask A
SetTexture [_MainTex] {
Combine texture
}
}
}
Fallback off
}