aboutsummaryrefslogtreecommitdiff
path: root/engine/src/core-effects/Common/MatDefs/Post/GammaCorrection15.frag
blob: b7861908a2424559467121cd98067fcc95d84886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#import "Common/ShaderLib/MultiSample.glsllib"
 
uniform COLORTEXTURE m_Texture;
in vec2 texCoord;
 
uniform float m_gamma;

vec3 gamma(vec3 L,float gamma)
{
	return pow(L, vec3(1.0 / gamma));
}
 
void main() {
    vec4 texVal = texture2D(m_Texture, texCoord);
 
 	if(m_gamma > 0.0)
 	{
    	texVal.rgb = gamma(texVal.rgb , m_gamma);
 	}
 	
 	#ifdef COMPUTE_LUMA
 		texVal.a = dot(texVal.rgb, vec3(0.299, 0.587, 0.114));
 	#endif
 
    gl_FragColor = texVal;
}