2020-05-31 17:07:22 +00:00
|
|
|
|
sampler2D _MainTex;
|
|
|
|
|
sampler2D _MaskTex;
|
|
|
|
|
|
|
|
|
|
fixed4 _Color;
|
|
|
|
|
|
|
|
|
|
#ifdef VEHICLE
|
|
|
|
|
int _CarColorIndex;
|
|
|
|
|
|
2021-02-13 21:18:27 +00:00
|
|
|
|
fixed3 _CarColor;
|
|
|
|
|
fixed _CarEmission;
|
2020-05-31 17:07:22 +00:00
|
|
|
|
|
|
|
|
|
float _Metallic;
|
|
|
|
|
float _Smoothness;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef FADE
|
|
|
|
|
sampler2D _NoiseTex;
|
|
|
|
|
|
|
|
|
|
fixed _Fade;
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-05-02 21:04:24 +00:00
|
|
|
|
float _NightMultiplier = 0.5;
|
2021-05-02 21:45:02 +00:00
|
|
|
|
float _HasNightColors = 0;
|
2021-04-25 22:43:30 +00:00
|
|
|
|
|
2020-05-31 17:07:22 +00:00
|
|
|
|
struct Input
|
|
|
|
|
{
|
|
|
|
|
float2 uv_MainTex;
|
2021-02-13 21:18:58 +00:00
|
|
|
|
#ifdef FADE
|
2020-05-31 17:07:22 +00:00
|
|
|
|
float4 screenPos;
|
2021-02-13 21:18:58 +00:00
|
|
|
|
#endif
|
2020-05-31 17:07:22 +00:00
|
|
|
|
float4 color : COLOR;
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-25 21:16:16 +00:00
|
|
|
|
void vert (inout appdata_full v) {
|
2021-05-02 21:04:24 +00:00
|
|
|
|
|
2021-04-25 22:43:30 +00:00
|
|
|
|
float4 c;
|
|
|
|
|
c.rg = v.texcoord1.xy;
|
|
|
|
|
c.ba = v.texcoord2.xy;
|
|
|
|
|
|
2021-05-02 21:45:02 +00:00
|
|
|
|
v.color = lerp(v.color, c, _NightMultiplier * _HasNightColors);
|
2021-04-25 21:16:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-31 17:07:22 +00:00
|
|
|
|
void surf(Input IN, inout SurfaceOutputStandard o)
|
|
|
|
|
{
|
|
|
|
|
#ifdef FADE
|
|
|
|
|
fixed noise = tex2D(_NoiseTex, IN.screenPos.xy / (IN.screenPos.w == 0 ? 1 : IN.screenPos.w)).a * .99;
|
|
|
|
|
fixed fade = fixed(_Fade < 0 ? noise > 1 + _Fade : noise < _Fade);
|
|
|
|
|
#else
|
|
|
|
|
fixed fade = 1;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
fixed3 clr = tex2D(_MainTex, IN.uv_MainTex).rgb;
|
|
|
|
|
fixed mask = tex2D(_MaskTex, IN.uv_MainTex).a;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
o.Albedo = clr
|
|
|
|
|
#ifdef VEHICLE
|
2021-02-13 21:18:27 +00:00
|
|
|
|
* _CarColor
|
2020-05-31 17:07:22 +00:00
|
|
|
|
#endif
|
|
|
|
|
* IN.color.rgb * _Color.rgb;
|
|
|
|
|
|
|
|
|
|
o.Alpha = fade * mask * IN.color.a * _Color.a;
|
|
|
|
|
|
|
|
|
|
#ifdef VEHICLE
|
|
|
|
|
o.Metallic = _Metallic * o.Alpha;
|
|
|
|
|
o.Smoothness = _Smoothness;
|
2021-02-13 21:18:27 +00:00
|
|
|
|
o.Emission = _CarEmission * o.Albedo;
|
2020-05-31 17:07:22 +00:00
|
|
|
|
#else
|
|
|
|
|
o.Metallic = 0;
|
|
|
|
|
o.Smoothness = 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|