You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.1 KiB
68 lines
1.1 KiB
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' |
|
|
|
Shader "Unity Shaders Book/Chapter 12/Motion Blur" { |
|
Properties { |
|
_MainTex ("Base (RGB)", 2D) = "white" {} |
|
_BlurAmount ("Blur Amount", Float) = 1.0 |
|
} |
|
SubShader { |
|
CGINCLUDE |
|
|
|
#include "UnityCG.cginc" |
|
|
|
sampler2D _MainTex; |
|
fixed _BlurAmount; |
|
|
|
struct v2f { |
|
float4 pos : SV_POSITION; |
|
half2 uv : TEXCOORD0; |
|
}; |
|
|
|
v2f vert(appdata_img v) { |
|
v2f o; |
|
|
|
o.pos = UnityObjectToClipPos(v.vertex); |
|
|
|
o.uv = v.texcoord; |
|
|
|
return o; |
|
} |
|
|
|
fixed4 fragRGB (v2f i) : SV_Target { |
|
return fixed4(tex2D(_MainTex, i.uv).rgb, _BlurAmount); |
|
} |
|
|
|
half4 fragA (v2f i) : SV_Target { |
|
return tex2D(_MainTex, i.uv); |
|
} |
|
|
|
ENDCG |
|
|
|
ZTest Always Cull Off ZWrite Off |
|
|
|
Pass { |
|
Blend SrcAlpha OneMinusSrcAlpha |
|
ColorMask RGB |
|
|
|
CGPROGRAM |
|
|
|
#pragma vertex vert |
|
#pragma fragment fragRGB |
|
|
|
ENDCG |
|
} |
|
|
|
Pass { |
|
Blend One Zero |
|
ColorMask A |
|
|
|
CGPROGRAM |
|
|
|
#pragma vertex vert |
|
#pragma fragment fragA |
|
|
|
ENDCG |
|
} |
|
} |
|
FallBack Off |
|
}
|
|
|