precision mediump float;

varying mediump vec2 vTextureCoord;

uniform sampler2D uSampler;
uniform sampler2D uSampler2; //map
uniform sampler2D uSampler3; //vigMap


void main()
{
    vec4 originColor = texture2D(uSampler, vTextureCoord);
    vec3 texel = texture2D(uSampler, vTextureCoord).rgb;

    texel = vec3(
    texture2D(uSampler2, vec2(texel.r, .16666)).r,
    texture2D(uSampler2, vec2(texel.g, .5)).g,
    texture2D(uSampler2, vec2(texel.b, .83333)).b);

    vec2 tc = (2.0 * vTextureCoord) - 1.0;
    float d = dot(tc, tc);
    vec2 lookup = vec2(d, texel.r);
    texel.r = texture2D(uSampler3, lookup).r;
    lookup.y = texel.g;
    texel.g = texture2D(uSampler3, lookup).g;
    lookup.y = texel.b;
    texel.b	= texture2D(uSampler3, lookup).b;

    texel.rgb = mix(originColor.rgb, texel.rgb, 1.0);

    gl_FragColor = vec4(texel, 1.0);
}