2016-07-26 19:27:02 +00:00
|
|
|
|
|
|
|
in vec2 TexCoord;
|
|
|
|
out vec4 FragColor;
|
|
|
|
|
|
|
|
uniform sampler2D InputTexture;
|
2016-08-15 22:01:18 +00:00
|
|
|
uniform float InvGamma;
|
2016-07-26 19:27:02 +00:00
|
|
|
uniform float Contrast;
|
|
|
|
uniform float Brightness;
|
|
|
|
|
|
|
|
vec4 ApplyGamma(vec4 c)
|
|
|
|
{
|
2016-09-21 19:08:53 +00:00
|
|
|
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
|
2016-07-26 19:27:02 +00:00
|
|
|
val += Brightness * 0.5;
|
2016-09-21 19:08:53 +00:00
|
|
|
val = pow(val, vec3(InvGamma));
|
2016-07-26 19:27:02 +00:00
|
|
|
return vec4(val, c.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
FragColor = ApplyGamma(texture(InputTexture, TexCoord));
|
|
|
|
}
|