Code: Select all
uniform vec2 imageSize;
bool isMagenta(vec4 pixel) {
float errorMargin = 0.05;
if (
(pixel.r >= (1 - errorMargin) && pixel.r <= 1) &&
(pixel.g >= 0 && pixel.g <= errorMargin) &&
(pixel.b >= (1 - errorMargin) && pixel.b <= 1)
) {
return true;
} else {
return false;
}
}
vec4 effect(vec4 loveColor, Image tex, vec2 uv, vec2 screenPos) {
vec2 uvPx = uv * imageSize; // I don't really know what this or the other next 2 lines do
vec2 f = fract(uvPx); //
vec4 pixel = Texel(tex, uv);
vec4 transparent = vec4(0, 0, 0, 0);
if (isMagenta(pixel)) {
return transparent;
} else {
return pixel;
}
}
To be this:
I'm guessing GLSL has something out of the box for this but I'm a total noob on it, any help would be appreciated. Thanks!