mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-30 00:48:00 +01:00
121 lines
2 KiB
Text
121 lines
2 KiB
Text
|
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 = UnityObjectToClipPos(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 = UnityObjectToClipPos(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
|
||
|
|
||
|
}
|