24 lines
559 B
GLSL
24 lines
559 B
GLSL
/*
|
|
"Uncharted 2" tonemap from MariENB
|
|
(C)2012-2023 Marisa the Magician
|
|
*/
|
|
vec3 Uch( vec3 res )
|
|
{
|
|
// I have no idea how this works
|
|
return ((res*(unA*res+unC*unB)+unD*unE)/(res*(unA*res+unB)+unD*unF))-unE/unF;
|
|
}
|
|
vec3 TonemapUC2( vec3 res )
|
|
{
|
|
vec3 ucol = Uch(res);
|
|
vec3 uwhite = Uch(vec3(unW));
|
|
return pow(max(ucol/uwhite,0.),vec3(1./2.2));
|
|
}
|
|
|
|
void main()
|
|
{
|
|
vec2 coord = TexCoord;
|
|
vec4 res = texture(InputTexture,coord);
|
|
vec3 mapped = TonemapUC2(pow(max(res.rgb*texposure,0.),vec3(2.2)));
|
|
res.rgb = mix(res.rgb,mapped,tblend);
|
|
FragColor = res;
|
|
}
|