2014-04-20 19:52:44 -04:00
|
|
|
uniform sampler2D tex;
|
2014-11-03 15:53:44 -05:00
|
|
|
uniform float vignette_weight;
|
2014-04-20 19:52:44 -04:00
|
|
|
|
|
|
|
out vec4 FragColor;
|
|
|
|
|
2016-06-26 10:39:34 -04:00
|
|
|
#stk_include "utils/getCIEXYZ.frag"
|
|
|
|
#stk_include "utils/getRGBfromCIEXxy.frag"
|
2014-04-20 19:52:44 -04:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2014-06-03 14:28:42 -04:00
|
|
|
vec2 uv = gl_FragCoord.xy / screen;
|
2014-04-20 19:52:44 -04:00
|
|
|
vec4 col = texture(tex, uv);
|
2014-04-25 20:00:50 -04:00
|
|
|
|
|
|
|
// Uncharted2 tonemap with Auria's custom coefficients
|
2014-04-25 20:02:16 -04:00
|
|
|
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
|
2017-03-25 17:23:46 -04:00
|
|
|
#if !(defined(GL_ES) && defined(Advanced_Lighting_Enabled))
|
2014-04-25 20:00:50 -04:00
|
|
|
perChannel = pow(perChannel, vec4(2.2));
|
2017-03-25 17:23:46 -04:00
|
|
|
#endif
|
2014-06-27 18:20:44 -04:00
|
|
|
|
2014-06-13 18:42:57 -04:00
|
|
|
vec2 inside = uv - 0.5;
|
2014-06-27 18:20:44 -04:00
|
|
|
float vignette = 1. - dot(inside, inside) * vignette_weight;
|
2014-06-13 18:42:57 -04:00
|
|
|
vignette = clamp(pow(vignette, 0.8), 0., 1.);
|
|
|
|
|
|
|
|
FragColor = vec4(perChannel.xyz * vignette, col.a);
|
2014-04-20 19:52:44 -04:00
|
|
|
}
|