varying vec2 texCoord;
uniform sampler2D colorMap;
uniform sampler2D palette;
uniform sampler2D mask;
//uniform float xc;

void main(void){
    float intensity = texture2D(colorMap,texCoord).r;
    float pallookup = texture2D(mask,texCoord).r;
    if (intensity<=0.0f) intensity+=1.0f/256.0f;
    if (intensity>=1.0f) intensity-=1.0f/256.0f;
    gl_FragColor = texture2D(palette, vec2(intensity,pallookup));
}
