- Home /
 
Projector affected by light and shadows(car vinyls, blood spatter or bullet holes)
I'm trying to project a decal onto a car that is affected by light and shadows.
I've messed around with this for many days now, here's what I have:
     Shader "VinylShader"
   {
   Properties {
         _Color ("Main Color", Color) = (1,1,1,1)       
      _ShadowTex ("Cookie", 2D) = "" { TexGen ObjectLinear }
      _FalloffTex ("FallOff", 2D) = "" { TexGen ObjectLinear }
   }
   Subshader {
   
     
      
    
      Pass {
         ZWrite off
         AlphaTest Greater 0
         Offset -1, -1
         //Fog { Color (0, 0, 0) }
         Color [_Color]
         ColorMask RGB
         
         
             Material {
                 Diffuse [_Color]
                 Ambient [_Color]
             }
             
             Lighting On
             SeparateSpecular On
          Blend SrcAlpha OneMinusSrcAlpha   
         //Blend DstColor One
         SetTexture [_ShadowTex] { combine texture* primary // primary, ONE - texture
            Matrix [_Projector]
         }
         SetTexture [_FalloffTex] {
            constantColor (0,0,0,0)
            combine previous lerp (texture) constant
            Matrix [_ProjectorClip]
         }
         
      }
      
   }
   
 }
 
               
                 
                unlitvinyl.jpg 
                (60.8 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Sondre-S · Feb 02, 2015 at 10:08 PM
Those who want a simple decal system, download the boot camp demo and look at the decal system there. Might not be the best choice, but it's free and it works great if you tweak it a bit like I did.
http://answers.unity3d.com/questions/891601/how-to-use-the-bootcampdecalsystem.html
Your answer