Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "GUI/Glitch"
- {
- Properties
- {
- _MainTex ("Base (RGB)", 2D) = "white" {}
- }
- SubShader
- {
- Pass
- {
- Ztest off Cull Off ZWrite Off Fog { Mode off }
- CGPROGRAM
- #pragma vertex vert_img
- #pragma fragment frag
- #pragma fragmentoption ARB_precision_hint_fastest
- #include "UnityCG.cginc"
- uniform sampler2D _MainTex;
- uniform float3 _Stats;
- inline float rand(float2 seed)
- {
- return frac(sin(dot(seed * floor(_Time * _Stats.x), float2(127.1, 311.7))) * 1.123456);
- }
- struct v2f {
- float4 pos : POSITION;
- float2 uv : TEXCOORD0;
- };
- v2f vert( appdata_img v )
- {
- v2f o;
- o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
- o.uv = v.texcoord.xy;
- return o;
- }
- half4 frag(v2f i) : COLOR
- {
- float2 rblock = rand(floor(i.uv * _Stats.y));
- float displaceNoise = pow(rblock.x, 8.0) * pow(rblock.x, 3.0) - pow(rand(7.2341), 17.0) * _Stats.z;
- float r = tex2D(_MainTex, i.uv).r;
- float b = tex2D(_MainTex, i.uv - half2(displaceNoise * 0.05 * rand(13.0), 0.0)).b;
- float g = tex2D(_MainTex, i.uv - half2(displaceNoise * 0.05 * rand(13.0), 0.0)).g;
- half4 color = tex2D(_MainTex, i.uv.xy);
- color.r = r*1.2;
- color.g = g;
- color.b = b;
- return color;
- }
- ENDCG
- }
- }
- FallBack off
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement