Hey everyone, I was just wondering if someone could take a moment and help me with my lighting problem. I use textures that are in grey scale then I color them how I like, whether thats green, blue, purple whatever. I have just finished work on lighting and whenever I try to multiply my color vector with my diffuse vector depending on the color of the light the object needing to be lit wont light up. For example and object that I color green (rgb=(0,1,0)) will not be lit up by a red light(rgb=(1,0,0)) but if I light my scene using only white lights (rgb=(1,1,1)) everything is fine. My main question is how can I get the colored light to combine with the color I change the texture to.
Here is my fragment shader. Distance is simply the distance from the vector to the light, lightColor is obviously the color of the light and attenuation is the attenuation factor of the light, and finally color is just the color of the object whether thats blue or green etc etc.
vec3 totalDiffuse = vec3(0.0);
for(int i = 0; i < 4; i++)
{
float attFactor = attenuation[i].x + (attenuation[i].y * distance[i]) + (attenuation[i].z * distance[i] * distance[i]);
totalDiffuse = totalDiffuse + (lightColor[i])/attFactor;
}
totalDiffuse = max(totalDiffuse,0.1);
out_Color = texture(textureSampler, pass_textureCoords)*vec4(color,alpha)*vec4(totalDiffuse,1.0);