小编kil*_*kev的帖子

有人可以解释一下片段着色器吗?这是一个色度键过滤器(绿屏效果)

我试图理解这个色度键过滤器是如何工作的.如果您不知道,色度键是绿屏效果.有人能够解释这些功能中的某些功能是如何工作的以及它们究竟在做什么?

float maskY = 0.2989 * colorToReplace.r + 0.5866 * colorToReplace.g + 0.1145 * colorToReplace.b;
 float maskCr = 0.7132 * (colorToReplace.r - maskY);
 float maskCb = 0.5647 * (colorToReplace.b - maskY);

 float Y = 0.2989 * textureColor.r + 0.5866 * textureColor.g + 0.1145 * textureColor.b;
 float Cr = 0.7132 * (textureColor.r - Y);
 float Cb = 0.5647 * (textureColor.b - Y);

 float blendValue = smoothstep(thresholdSensitivity, thresholdSensitivity + smoothing, distance(vec2(Cr, Cb), vec2(maskCr, maskCb)));


 gl_FragColor = vec4(textureColor.rgb * blendValue, 1.0 * blendValue); …
Run Code Online (Sandbox Code Playgroud)

opengl colors glsl video-processing fragment-shader

7
推荐指数
1
解决办法
5167
查看次数

标签 统计

colors ×1

fragment-shader ×1

glsl ×1

opengl ×1

video-processing ×1