Add keying tolerance controls
This commit is contained in:
@@ -24,11 +24,19 @@ namespace olive {
|
||||
|
||||
const QString ChromaKeyNode::kColorInput = QStringLiteral("color_key");
|
||||
const QString ChromaKeyNode::kMaskOnlyInput = QStringLiteral("mask_only_in");
|
||||
const QString ChromaKeyNode::kUpperToleranceInput = QStringLiteral("upper_tolerence_in");
|
||||
const QString ChromaKeyNode::kLowerToleranceInput = QStringLiteral("lower_tolerence_in");
|
||||
|
||||
ChromaKeyNode::ChromaKeyNode()
|
||||
{
|
||||
AddInput(kColorInput, NodeValue::kColor, QVariant::fromValue(Color(0.0f, 1.0f, 0.0f, 1.0f)));
|
||||
|
||||
AddInput(kUpperToleranceInput, NodeValue::kFloat, 25.0);
|
||||
SetInputProperty(kUpperToleranceInput, QStringLiteral("min"), 0.0);
|
||||
|
||||
AddInput(kLowerToleranceInput, NodeValue::kFloat, 5.0);
|
||||
SetInputProperty(kLowerToleranceInput, QStringLiteral("min"), 0.0);
|
||||
|
||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||
}
|
||||
|
||||
@@ -62,6 +70,8 @@ void ChromaKeyNode::Retranslate()
|
||||
//SetComboBoxStrings(kColorInput, {tr("Green"), tr("Blue")});
|
||||
//SetInputName(kShadowsInput, tr("Shadows"));
|
||||
//SetInputName(kHighlightsInput, tr("Highlights"));
|
||||
SetInputName(kUpperToleranceInput, tr("Upper Tolerance"));
|
||||
SetInputName(kLowerToleranceInput, tr("Lower Tolerance"));
|
||||
SetInputName(kMaskOnlyInput, tr("Show Mask Only"));
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ class ChromaKeyNode : public OCIOBaseNode {
|
||||
|
||||
static const QString kColorInput;
|
||||
static const QString kMaskOnlyInput;
|
||||
static const QString kUpperToleranceInput;
|
||||
static const QString kLowerToleranceInput;
|
||||
|
||||
private:
|
||||
void GenerateProcessor();
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
uniform sampler2D tex_in;
|
||||
uniform vec4 color_key;
|
||||
uniform bool mask_only_in;
|
||||
uniform float upper_tolerence_in;
|
||||
uniform float lower_tolerence_in;
|
||||
|
||||
|
||||
// Main texture coordinate
|
||||
@@ -55,7 +57,7 @@ void main() {
|
||||
vec4 cie_xyz_key = SceneLinearToCIEXYZ_d65(color_key);
|
||||
vec4 lab_key = CIExyz_to_Lab(cie_xyz_key);
|
||||
|
||||
float mask = colorclose(lab, lab_key, 5.0, 25.0);
|
||||
float mask = colorclose(lab, lab_key, lower_tolerence_in, upper_tolerence_in);
|
||||
|
||||
col.rgb *= mask;
|
||||
col.w = mask;
|
||||
|
||||
Reference in New Issue
Block a user