Restore flip shader and put the color correction in a dedicated shader
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14632 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
26
data/shaders/color_levels.frag
Normal file
26
data/shaders/color_levels.frag
Normal file
@@ -0,0 +1,26 @@
|
||||
uniform sampler2D tex;
|
||||
uniform vec3 inlevel;
|
||||
uniform vec2 outlevel;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texc = gl_TexCoord[0].xy;
|
||||
texc.y = 1.0 - texc.y;
|
||||
|
||||
|
||||
vec4 col = texture2D(tex, texc);
|
||||
|
||||
//col = col / (1 - col);
|
||||
|
||||
float inBlack = inlevel.x;
|
||||
float inWhite = inlevel.z;
|
||||
float inGamma = inlevel.y;
|
||||
|
||||
float outBlack = outlevel.x;
|
||||
float outWhite = outlevel.y;
|
||||
|
||||
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
||||
|
||||
gl_FragColor = vec4(col.rgb, 1.0);
|
||||
}
|
||||
@@ -5,23 +5,6 @@ void main()
|
||||
vec2 texc = gl_TexCoord[0].xy;
|
||||
texc.y = 1.0 - texc.y;
|
||||
|
||||
|
||||
vec4 col = texture2D(tex, texc);
|
||||
|
||||
//col = col / (1 - col);
|
||||
|
||||
|
||||
float inBlack = 0.0;
|
||||
float inWhite = 137.0;
|
||||
float inGamma = 0.65;
|
||||
|
||||
|
||||
float outWhite = 255.0;
|
||||
float outBlack = 0.0;
|
||||
|
||||
|
||||
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
||||
|
||||
gl_FragColor = vec4(col.rgb, 1.0);
|
||||
gl_FragColor = vec4(texture2D(tex, texc).rgb, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user