Grafika_2024/projekt_grk/shaders/shader_coin.frag

18 lines
359 B
GLSL
Raw Normal View History

2024-03-01 16:58:55 +01:00
#version 430 core
float AMBIENT = 0.1;
uniform vec3 color;
uniform vec3 lightPos;
in vec3 vecNormal;
in vec3 worldPos;
out vec4 finalColor;
void main()
{
vec3 lightDir = normalize(lightPos-worldPos);
vec3 normal = normalize(vecNormal);
float diffuse=max(0,dot(normal,lightDir));
finalColor = vec4(color*min(1,AMBIENT+diffuse), 1.0);
}