I’m writing a shader that is supposed to check if there is any light. If there is then it gets drawn as highlight color otherwise it gets drawn as shadow color. The two colors aren’t supposed to interact with each other but for a reason I can’t seem to find in my code they are.
Here’s the code:
Shader "Custom/Shader 1" {
Properties {
_ShadowColor("Shadow Color", Color) = (0.0, 0.0, 0.0, 0.0)
_HighlightColor("Highlight Color", Color) = (1.0, 1.0, 1.0, 0.0)
}
SubShader {
Tags {
"Queue" = "Geometry"
"RenderType" = "Opaque"
}
CGPROGRAM
#pragma surface surf DuelColor
#include "UnityCG.cginc"
half4 _ShadowColor;
half4 _HighlightColor;
half4 LightingDuelColor(SurfaceOutput s, half3 lightDir, half atten) {
half4 c;
half NdotL = dot(s.Normal, lightDir);
if (Luminance(s.Albedo * _LightColor0.rgb * (NdotL * atten)) > 0) {
c.rgb = _HighlightColor.rgb;
}
else {
c.rgb = _ShadowColor.rgb;
}
c.a = 0.0;
return c;
}
struct Input {
float4 Color : COLOR;
};
void surf(Input IN, inout SurfaceOutput o) {
o.Albedo = fixed3(1.0, 1.0, 1.0);
}
ENDCG
}
}
Here’s what’s happening:
As you can see it should be showing up as green and red but instead it’s showing up as red and yellow which is a mix of green and red. If someone knows what’s happening please tell me. Thank you in advance



Thank you, I had a feeling it had to do with the fact that I was using a surface shader instead of a vertex fragment shader. Thank you very much ^_^
– dillon_kneeland