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]
}
}
}
}