Added luma key effect
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user