Look at this code and tell me, which color shader will return?
fixed4 frag (v2f i) : SV_Target
{
fixed4 col;
half3 aa = (1, 0,0);
half3 bb = (1, 0,0);
half Test = (0.5 + 0.5 * dot(aa, bb));
col.x = Test;
col.y = Test;
col.z = Test;
col.w = 1;
return col;
}
If you said white (because it’s obvious that dot product two equal vectors must be 1), well you wrong. Final color of plane is gray.
So why is that?? It’s definitely not because I using half3 (float3 and fixed3 not working as well), and yes I included “UnityCG.cginc”.
The fun part is that
(dot(i.normal, _WorldSpaceLightPos0) * 0.5 + 0.5);
working fine…
So does anyone has any suggestions? Is it bug or something?