uniform vec4 U_AmbientLightColor; uniform vec4 U_AmbientMaterial; uniform vec3 U_LightPos; uniform vec4 U_DiffuseLightColor; uniform vec4 U_DiffuseMaterial; varying vec3 V_Normal; void main() { //ambient vec4 ambientColor = U_AmbientLightColor * U_AmbientMaterial; //diffuse vec3 N = normalize(V_Normal); vec3 L = normalize(U_LightPos); float diffuseIntensity = max(0.0, dot(L,N)); vec4 diffuseColor = U_DiffuseLightColor * U_DiffuseMaterial * diffuseIntensity; gl_FragColor = ambientColor + diffuseColor; }