In this picture, my blue cube light (toon)shader is hitting the plane quad at about 40degree from the plane and produces a light pink, which is the correct color. At this point you can see my camera is ~5units from the plane.
In this picture, the plane shows its base color, as if the light isnt even there, even though all i did was move my camera out 20 units. It SHOULD be light pink just as when the camera was close to the plane.
This has not been a problem with Opengl's fixed-function lighting.
.vert
varying vec3 normal;
varying vec4 c;
void main()
{
c = gl_Color;
normal = gl_NormalMatrix * gl_Normal;
gl_Position = ftransform();
}
.frag
varying vec3 normal;
varying vec4 c;
void main()
{
float intensity;
vec4 color;
vec3 n = normalize(normal);
vec3 lightvector = normalize(vec3(gl_LightSource[0].position));
intensity = dot(lightvector, n);
if (intensity > 0.90)
color = c + vec4(1.0,0.5,0.5,1.0);
else if (intensity > 0.5)
color = c + vec4(0.6,0.3,0.3,1.0);
else if (intensity > 0.2)
color = c + vec4(0.4,0.2,0.2,1.0);
else
color = c + vec4(0.2,0.1,0.1,1.0);
gl_FragColor = color;
}