title: Unity make object fade when touched by light
body: <p>I have objects in my game I want to be invisible when they get hit by light</p>
  
  <p>The effect I'm looking for is something like the lens of truth from Zelda Ocarina of Time </p>
  
  <p>I got it working by doing Raycasts from the lightsource in the direction of my objects and it's corners</p>
  
  <p>But now I want to see if I can get it to work like the lens of truth (if the light hits a part of the object it only fades that part.</p>
  
  <pre><code>Shader "Custom/Matte Shadow" {
  
  Properties{
      _Color("Main Color", Color) = (1,1,1,1)
      _MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
  _Cutoff("Alpha cutoff", Range(0,1)) = 0.5
  }
  
      SubShader{
      Tags{ "Queue" = "AlphaTest" "RenderType" = "TransparentCutout" }
      LOD 200
      Blend Zero SrcColor
      Offset 0, -1
  
      CGPROGRAM
  
  #pragma surface surf ShadowOnly alphatest:_Cutoff fullforwardshadows
  
      fixed4 _Color;
  
      struct Input {
          float2 uv_MainTex;
      };
  
      inline fixed4 LightingShadowOnly(SurfaceOutput s, fixed3 lightDir, fixed atten) {
          fixed4 c;
  
          c.rgb = s.Albedo*atten;
          c.a = s.Alpha;
          return c;
      }
  
      void surf(Input IN, inout SurfaceOutput o) {
          fixed4 c = _Color;
          o.Albedo = c.rgb;
          o.Alpha = 0.0f;
      }
  ENDCG
  }
  Fallback "Transparent/Cutout/VertexLit"
  }
  </code></pre>
  
  <p>currently I have this shader.</p>
  
  <p>it makes the object transparent but when lit it receives shadows.</p>
  
  <p>The problem is that it's still visible, I need it to be invisible under the LIGHT and VISIBLE in the SHADOWS.</p>
  
  <p><a href="https://i.stack.imgur.com/TXoEi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TXoEi.png" alt="enter image description here"></a></p>