m2-ar-projet/shaders/main.frag

17 lines
375 B
GLSL

varying vec3 norm;
varying vec2 uv;
varying vec3 frag_pos;
uniform sampler2D tex;
void main() {
vec3 light_col = vec3(1, .964, .783);
vec3 ambient = light_col * .2;
vec3 light_dir = normalize(vec3(5, 10, -8));
float diff = max(dot(normalize(norm), light_dir), 0.0);
vec3 diffuse = diff * light_col;
gl_FragColor = texture2D(tex, uv) * vec4(ambient + diffuse, 1);
}