From 8ce00fd97589d53f3e0d2ce1fda60374db381a04 Mon Sep 17 00:00:00 2001 From: Thomas Wilshaw Date: Tue, 19 Sep 2023 15:24:52 +0100 Subject: [PATCH] chromakey.frag: Fix color distance equation The equation for calculating the distance from the key color to a pixels color was missing the red channel component. --- app/shaders/chromakey.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/shaders/chromakey.frag b/app/shaders/chromakey.frag index d3ee70e6c..27911144b 100644 --- a/app/shaders/chromakey.frag +++ b/app/shaders/chromakey.frag @@ -48,7 +48,7 @@ vec4 CIExyz_to_Lab(vec4 CIE) { float colorclose(vec4 col, vec4 key, float tola,float tolb) { // Decides if a color is close to the specified hue - float temp = sqrt(((key.g-col.g)*(key.g-col.g))+((key.b-col.b)*(key.b-col.b))); + float temp = sqrt(((key.g-col.g)*(key.g-col.g))+((key.b-col.b)*(key.b-col.b))+((key.b-col.r)*(key.b-col.r))); if (temp < tola) {return (0.0);} if (temp < tolb) {return ((temp-tola)/(tolb-tola));} return (1.0);