1uniform sampler2D m_Texture;
2varying vec2 texCoord;
3
4uniform int m_NumColors;
5uniform float m_Gamma;
6uniform float m_Strength;
7
8void main() {
9    vec4 texVal = texture2D(m_Texture, texCoord);
10
11    texVal = pow(texVal, vec4(m_Gamma));
12    texVal = texVal * vec4(m_NumColors);
13    texVal = floor(texVal);
14    texVal = texVal / vec4(m_NumColors);
15    texVal = pow(texVal, vec4(1.0/m_Gamma));
16
17    gl_FragColor = mix(texture2D(m_Texture, texCoord), texVal, m_Strength);
18}