#version 330 core in vec3 frag_position; in vec3 frag_normal; in vec2 frag_uv; uniform sampler2D u_texture; uniform vec3 u_color = vec3(1, 1, 1); uniform vec3 u_light_direction = vec3(-1, 3, -2); out vec4 FragColor; void main() { // Sample texture vec4 tex_color = texture(u_texture, frag_uv); // Face normal vec3 normal = normalize(frag_normal); // Directional lighting vec3 light_direction = normalize(u_light_direction); float diffuse = max(dot(normal, light_direction), 0.0); // Ambient + diffuse float ambient = 0.25; float lighting = ambient + diffuse * 0.75; // Final color vec3 color = tex_color.rgb * u_color * lighting; FragColor = vec4(color, tex_color.a); }