Shader "Custom/GlassBlur" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Distortion ("Distortion", Range(0.0,1.0)) = 0.5 _BlurSize ("Blur Size", Range(0.0,1.0)) = 0.2 } SubShader { Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} LOD 200 Blend SrcAlpha OneMinusSrcAlpha ZWrite Off AlphaTest Greater 0.5 Cull Off Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata_t { float4 vertex : POSITION; float2 texcoord : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; float4 pos : SV_POSITION; }; sampler2D _MainTex; float4 _MainTex_ST; float _Distortion; float _BlurSize; v2f vert (appdata_t v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } fixed4 frag (v2f i) : SV_Target { float2 uv = i.uv; float2 offset = float2(_Distortion, _Distortion) * _BlurSize; float4 col = tex2D(_MainTex, uv); col += tex2D(_MainTex, uv + float2(offset.x, offset.y)); col += tex2D(_MainTex, uv + float2(-offset.x, offset.y)); col += tex2D(_MainTex, uv + float2(offset.x, -offset.y)); col += tex2D(_MainTex, uv + float2(-offset.x, -offset.y)); col /= 5.0; return col; } ENDCG } } FallBack "Diffuse" }