I\'m trying to understand how this chroma key filter works. Chroma Key, if you don\'t know, is a green screen effect. Would someone be able to explain how some of these func
The smoothstep
function in GLSL evaluates a smooth cubic curve over an interval (specified by the first two parameters). As compared to GLSL's mix
function, which linearly blends its parameters as:
smoothstep
uses a Hermite cubic polynomial to determine the value
In your shader, blendValue is a smooth interpolation of your smoothing value based on the distance between the red and blue chrominance values.
Finally, gl_FragColor
specifies the final fragment color (before blending, which occurs after completion of the fragment shader). In your case, it's the modulated value read from the input image, and a modulated alpha value for translucency.