这对绿屏非常有用,我的背景是绿色的,使用此代码可以使绿色 = alpha。
lowp vec4 textureColor = texture2D(u_samplers2D[0], vTextu);
lowp float rbAverage = textureColor.r * 0.5 + textureColor.b * 0.5;
lowp float gDelta = textureColor.g - rbAverage;
textureColor.a = 1.0 - smoothstep(0.0, 0.25, gDelta);
textureColor.a = textureColor.a * textureColor.a * textureColor.a;
gl_FragColor = textureColor;
如何更改代码以使其使用黑色背景而不是绿色?我想我可以获得深红色、绿色、蓝色的值,然后将其用作 alpha?任何指针都会很友好。