16 lines
570 B
GLSL
16 lines
570 B
GLSL
#version 330 core
|
|
out vec4 FragColor;
|
|
in vec2 TexCoord;
|
|
uniform sampler2D InputTexture;
|
|
|
|
vec3 linearToSrgb(vec3 linearRGB) {
|
|
linearRGB = max(linearRGB, vec3(0.0)); // Ensure non-negative input
|
|
vec3 srgb = pow(linearRGB, vec3(1.0/2.4));
|
|
srgb = mix(linearRGB * 12.92, srgb * 1.055 - 0.055, step(vec3(0.0031308), linearRGB));
|
|
return clamp(srgb, 0.0, 1.0); // Clamp final output to display range
|
|
}
|
|
|
|
void main() {
|
|
vec3 linearColor = texture(InputTexture, TexCoord).rgb;
|
|
FragColor = vec4(linearToSrgb(linearColor), texture(InputTexture, TexCoord).a);
|
|
} |