townforge/GameData/Shaders/GLSL/TF_GammaCorrection.glsl

29 lines
611 B
GLSL

#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
#include "ScreenPos.glsl"
varying vec2 vScreenPos;
#ifdef COMPILEPS
uniform float cGammaValue;
#endif
void VS()
{
mat4 modelMatrix = iModelMatrix;
vec3 worldPos = GetWorldPos(modelMatrix);
gl_Position = GetClipPos(worldPos);
vScreenPos = GetScreenPosPreDiv(gl_Position);
}
void PS()
{
vec3 color = texture2D(sDiffMap, vScreenPos).rgb;
if (cGammaValue != 1.0)
color = vec3(pow(color.r, cGammaValue), pow(color.g, cGammaValue), pow(color.b, cGammaValue));
gl_FragColor = vec4(color, 1.0);
}