Grafika_2024/projekt_grk/shaders/shader_sun.frag

23 lines
592 B
GLSL

#version 430 core
layout (location = 0) out vec4 outColor;
layout (location = 1) out vec4 BrightColor;
uniform float exposition;
uniform sampler2D sunTexture;
in vec2 TexCoords;
void main()
{
vec3 textureColor = texture(sunTexture, TexCoords).xyz;
vec3 adjustedColor = textureColor * exposition;
vec3 finalColor = clamp(adjustedColor, 0.0, 1.0);
outColor = vec4(finalColor, 1.0);
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
if(brightness > 0.2)
BrightColor = vec4(finalColor, 1.0);
else
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
}