Simple2.fragsh 700 Bytes
/*==============================================================================
 Copyright (c) 2012-2015 Qualcomm Connected Experiences, Inc.
 All Rights Reserved.
 ==============================================================================*/

precision mediump float;
varying vec2 texCoord;

uniform sampler2D texSampler2D;

void main()
{
    vec3 keying_color = vec3(0,1,0);
    float thresh = 0.8;
    float slope = 0.2;
    vec3 input_color = texture2D(texSampler2D, texCoord).rgb;
    float d = abs(length(abs(keying_color.rgb - input_color.rgb)));
    float edge0 = thresh * (1.0 - slope);
    float alpha = smoothstep(edge0, thresh, d);
    
    gl_FragColor = vec4(input_color, alpha);
}