I have a PlaneGeometry and I'm randomly animating the vertices in order to create random spikes. I use this FragmentShader :
void main() {
vec3 light = vec3(cos(time),sin(time),1.0);
light = normalize(light);
float dProd = max(0.0, dot(vNormal, light));
gl_FragColor = vec4(dProd,dProd,dProd,1.0);
}
I expected to have some faces of each spike colored in black, but instead I got a solid color. I placed a Sphere on my plane and applied the same shader:
When I turn the wireframe OFF :
Not sure I understand what's happening on the plane?! I thought that since each spike has different normals, they should have different lighting as well.