Can someone please explain this Fragment Shader? It is a Chroma Key Filter (Green screen effect)

后端 未结 1 1390
不知归路
不知归路 2020-12-18 00:52

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

相关标签:
1条回答
  • 2020-12-18 01:17

    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:

    GLSL's <code>mix</code> function

    smoothstep uses a Hermite cubic polynomial to determine the value

    GLSL's <code>smoothstep</code> function

    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.

    0 讨论(0)
提交回复
热议问题