PlanetEditor/grk/cw 6/shaders/shader_tex.frag

23 lines
398 B
GLSL

#version 430 core
float AMBIENT = 0.1;
uniform vec3 lightDir;
in vec3 vecNormal;
//in vec3 worldPos;
out vec4 outColor;
in vec2 vTC;
uniform sampler2D colorTexture;
void main()
{
vec3 normal = normalize(vecNormal);
float diffuse = max(0.0, dot(normal, -lightDir));
vec4 textureColor = texture2D(colorTexture, vTC);
outColor = vec4(vec3(textureColor) * min(1, AMBIENT + diffuse), 1.0);
}