GRK/cw 5/shaders/shader_4_sun.frag

18 lines
358 B
GLSL
Raw Normal View History

2022-01-12 16:07:16 +01:00
#version 410 core
uniform vec3 objectColor;
//uniform vec3 lightDir;
uniform vec3 lightPos;
uniform vec3 cameraPos;
in vec3 interpNormal;
in vec3 fragPos;
void main()
{
vec3 normal = normalize(interpNormal);
vec3 V = normalize(cameraPos-fragPos);
float coef = max(0,dot(V,normal));
gl_FragColor = vec4(mix(objectColor,vec3(0.2,0.5,0),1-coef), 1.0);
}