Added luma key effect

This commit is contained in:
oc1024
2019-01-23 08:25:18 -03:00
committed by GitHub
parent 9186eac9ca
commit 5b4d80edad
2 changed files with 31 additions and 0 deletions
+21
View File
@@ -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;
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Luma Key" category="Keying">
<row name="Lower Limit">
<field type="double" min="0" default="0" max="1" id="loc"/>
</row>
<row name="Upper Limit">
<field type="double" min="0" default="1" max="1" id="hic"/>
</row>
<shader vert="common.vert" frag="lumakey.frag"/>
</effect>