Space-Project/shaders/shader_4_sun.frag

22 lines
562 B
GLSL
Raw Normal View History

2021-01-16 17:11:39 +01:00
#version 430 core
uniform vec3 objectColor;
//uniform vec3 lightDir;
uniform vec3 lightPos;
uniform vec3 cameraPos;
uniform sampler2D colorTexture;
2021-01-17 01:26:29 +01:00
uniform vec3 colorTex;
2021-01-16 17:11:39 +01:00
in vec3 interpNormal;
in vec3 fragPos;
in vec2 vTexCoord;
2021-01-16 17:11:39 +01:00
void main()
{
vec3 normal = normalize(interpNormal);
vec3 V = normalize(cameraPos-fragPos);
float coef = pow(max(0,dot(normal,V)),3);
vec4 textureColor = texture2D(colorTexture, -vTexCoord);
2021-01-17 01:26:29 +01:00
vec3 texture = vec3(textureColor.x, textureColor.y, textureColor.z) * colorTex;
gl_FragColor = vec4(texture + texture * coef, 1.0);
2021-01-16 17:11:39 +01:00
}