From 5b4d80edadf21ca218204da0335b0dd903d1f307 Mon Sep 17 00:00:00 2001 From: oc1024 Date: Wed, 23 Jan 2019 08:25:18 -0300 Subject: [PATCH] Added luma key effect --- effects/lumakey.frag | 21 +++++++++++++++++++++ effects/lumakey.xml | 10 ++++++++++ 2 files changed, 31 insertions(+) create mode 100644 effects/lumakey.frag create mode 100644 effects/lumakey.xml diff --git a/effects/lumakey.frag b/effects/lumakey.frag new file mode 100644 index 000000000..3e7b0d266 --- /dev/null +++ b/effects/lumakey.frag @@ -0,0 +1,21 @@ +/* Luma key simple program +Based on Edward Cannon's Simple Chroma Key (adaptation by Olive Team) +Feel free to modify and use at will */ + +uniform sampler2D tex; +varying vec2 vTexCoord; + +uniform float loc; +uniform float hic; + +void main(void) { + vec4 texture_color = texture2D(tex,vTexCoord); + + float luma = max(max(texture_color.r,texture_color.g), texture_color.b) + min(min(texture_color.r,texture_color.g), texture_color.b); + + luma /= 2.0; + + texture_color.a = (luma >= loc && luma <= hic) ? luma : 0.0; + + gl_FragColor = texture_color; +} \ No newline at end of file diff --git a/effects/lumakey.xml b/effects/lumakey.xml new file mode 100644 index 000000000..03b933877 --- /dev/null +++ b/effects/lumakey.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file