I’ve tried lot of shaders and for some reason Directional Light doesn’t work with them as I’d wish. Looks like the specular depends of the distance to the light and direction. I’ve ended up using custom light from the examples.
half4 LightingSimpleSpecular (SurfaceOutput s, half3 lightDir, half3 viewDir) {
half3 h = normalize (half3(0,50,-15)+viewDir);
half diff = max (0, dot (s.Normal, lightDir));
float nh = max (0, dot (s.Normal, h));
float spec = pow (nh, 128.0);
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec;
c.a = s.Alpha;
return c;
}
I’ve replaced the half3 h = normalize (lightDir+viewDir); with some constant vector
It works fine but in “local” coordinates. How could I pass here the World Coordinates constant vector?