Shader "Unlit/AboutBg" { Properties { _Width ("_Width", float) = 30 } SubShader { Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} LOD 100 ZWrite Off Blend SrcAlpha OneMinusSrcAlpha Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag // make fog work #pragma multi_compile_fog #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; float _Width; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = v.uv;//TRANSFORM_TEX(v.uv, _MainTex); //UNITY_TRANSFER_FOG(o,o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { // sample the texture fixed4 col = fixed4(0,0,0,1); float ww = _Width; float hh = _Width * _ScreenParams.y/_ScreenParams.x; float x0 = saturate( abs(i.uv.x)*ww );//はしっこほど0 float x1 = saturate( abs(1-i.uv.x)*ww );//はしっこほど0 float y0 = saturate( abs(i.uv.y)*hh );//はしっこほど0 float y1 = saturate( abs(1-i.uv.y)*hh );//はしっこほど0 float value = 1-min( min(y0,y1),min(x0,x1) ); //col.rgb = col.a = value; //col.a = (1 - col.a); // apply fog //UNITY_APPLY_FOG(i.fogCoord, col); return col; } ENDCG } } }