Grafika_2024/projekt_grk/shaders/shader_sun.frag

23 lines
592 B
GLSL
Raw Normal View History

2024-01-29 22:05:00 +01:00
#version 430 core
2024-02-28 19:19:59 +01:00
layout (location = 0) out vec4 outColor;
layout (location = 1) out vec4 BrightColor;
2024-02-20 15:37:59 +01:00
uniform float exposition;
uniform sampler2D sunTexture;
2024-01-29 22:05:00 +01:00
2024-02-20 15:37:59 +01:00
in vec2 TexCoords;
2024-01-29 22:05:00 +01:00
void main()
{
2024-02-20 15:37:59 +01:00
vec3 textureColor = texture(sunTexture, TexCoords).xyz;
vec3 adjustedColor = textureColor * exposition;
2024-02-28 19:19:59 +01:00
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);
2024-01-29 22:05:00 +01:00
}