From ea4624fbef6e9d8f58da12be363807eb19a37b53 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 17 Sep 2021 09:33:17 +0800 Subject: +glitch --- .../Unit/ImageEffect/unit_img_glitch.shader | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_glitch.shader') diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_glitch.shader b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_glitch.shader index 2e2c9fa2..62f75459 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_glitch.shader +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_glitch.shader @@ -1,4 +1,4 @@ -Shader "Unlit/unit_effect_glitch" +Shader "Erika/Unit/ImageEffect/unit_img_glitch" { Properties { @@ -6,16 +6,19 @@ } SubShader { - Tags { "RenderType"="Opaque" } - LOD 100 + Tags { "RenderType" = "Opaque" "Queue" = "Transparent-1"} + LOD 100 + + ZWrite Off + ZTest LEqual + + Blend SrcAlpha OneMinusSrcAlpha Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag - // make fog work - #pragma multi_compile_fog #include "UnityCG.cginc" @@ -28,7 +31,6 @@ struct v2f { float2 uv : TEXCOORD0; - UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; @@ -40,17 +42,19 @@ v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); - UNITY_TRANSFER_FOG(o,o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { + float amount = 0.01; // sample the texture - fixed4 col = tex2D(_MainTex, i.uv); - // apply fog - UNITY_APPLY_FOG(i.fogCoord, col); - return col; + fixed4 col = tex2D(_MainTex, i.uv + fixed2(0, 0)); + fixed4 col2 = tex2D(_MainTex, i.uv + fixed2(amount, 0)); + fixed4 col3 = tex2D(_MainTex, i.uv + fixed2(-amount, 0)); + fixed4 col4 = tex2D(_MainTex, i.uv + fixed2(0, 0)); + fixed4 color = fixed4(col.r, col2.g, col3.b, col4.a); + return color; } ENDCG } -- cgit v1.1-26-g67d0