mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-11 21:21:45 +00:00
ce50b0e46b
Works for most shaders, except SSAO.
23 lines
567 B
GLSL
23 lines
567 B
GLSL
|
|
in vec2 TexCoord;
|
|
layout(location=0) out vec4 FragColor;
|
|
|
|
layout(binding=0) uniform sampler2D InputTexture;
|
|
|
|
vec4 ApplyGamma(vec4 c)
|
|
{
|
|
vec3 valgray;
|
|
if (GrayFormula == 0)
|
|
valgray = vec3(c.r + c.g + c.b) * (1 - Saturation) / 3 + c.rgb * Saturation;
|
|
else
|
|
valgray = mix(vec3(dot(c.rgb, vec3(0.3,0.56,0.14))), c.rgb, Saturation);
|
|
vec3 val = valgray * Contrast - (Contrast - 1.0) * 0.5;
|
|
val += Brightness * 0.5;
|
|
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
|
|
return vec4(val, c.a);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
FragColor = ApplyGamma(texture(InputTexture, TexCoord));
|
|
}
|