title: Darken a gameobject which cross fog border
body: <p>I created fog by raw image and material with custom shader.</p>
  
  <p>Now I want to darken some gameobjects(sprites) which cross fog border.</p>
  
  <p>But I'm noob in shaders. How I can do this? Write any links on manuals/tutorials or some ideas.</p>
  
  <p>Picture for clarity: <img src="https://i.stack.imgur.com/stMea.png" alt="picture">
                       <img src="https://image.ibb.co/gtC5BQ/Screenshot_7.png" alt="picture"></p>
  
  <p>Fog shader:</p>
  
  <pre><code>Shader "Custom/Fog" {
  Properties{
      _Color("Main Color", Color) = (1,1,1,1)
      _MainTex("Base (RGB)", 2D) = "white" {} // Base (RGB)
  }
      SubShader{
          Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" "LightMode" = "ForwardBase" "IgnoreProjector" = "True" }
          Blend SrcAlpha  OneMinusSrcAlpha
          Lighting Off
          LOD 200
  
          CGPROGRAM
  
              #pragma surface surf NoLighting noambient alpha:blend
  
              fixed4 _Color;
              sampler2D _MainTex;
  
              struct Input {
                  float2 uv_MainTex;
              };
  
  
              void surf(Input IN, inout SurfaceOutput o) {
  
                  half4 baseColor = tex2D(_MainTex, IN.uv_MainTex);
                  o.Albedo = _Color.rgb * baseColor.b;
                  o.Alpha = _Color.a - baseColor.g;
              }
          ENDCG
     }
        FallBack "Diffuse"
  }
  </code></pre>