24 b.use_custom_socket_order();
25 b.allow_any_socket_order();
27 b.add_input<
decl::Color>(
"Image"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f}).hide_value();
28 b.add_output<
decl::Color>(
"Image"_ustr).align_with_previous();
31 b.add_input<
decl::Color>(
"Key Color"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f});
36 "If the angle between the color and the key color in CrCb space is less than this "
37 "minimum angle, it is keyed");
42 "If the angle between the color and the key color in CrCb space is larger than this "
43 "maximum angle, it is not keyed");
50 "Controls the falloff between keyed and non-keyed values. 0 means completely sharp and "
51 "1 means completely smooth");
83 float2 color_cc = color_ycca.yz() * 2.0f - 1.0f;
91 float foreground_key = color_cc.x - (
math::abs(color_cc.y) /
math::tan(maximum / 2.0f));
95 float alpha =
color.w;
96 if (foreground_key > 0.0f) {
97 alpha = 1.0f - (foreground_key / falloff);
114 return mf::build::SI5_SO2<Color, Color, float, float, float, Color, float>(
117 const Color &key_color,
118 const float &minimum,
119 const float &maximum,
120 const float &falloff,
122 float &matte) ->
void {
126 output_color =
Color(out_color);
128 mf::build::exec_presets::SomeSpanOrSingle<0, 1>());
#define CMP_NODE_CHROMA_MATTE
#define BLI_YCC_ITU_BT709
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void construct_and_set_matching_fn_cb(Fn &&create_multi_function)
void node_register_type(bNodeType &ntype)
ColorSceneLinear4f< eAlpha::Premultiplied > Color
T min(const T &a, const T &b)
MatBase< T, 2, 2 > from_direction(const VecBase< T, 2 > &direction)
T atan2(const T &y, const T &x)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
T tan(const AngleRadianBase< T > &a)
static void node_build_multi_function(nodes::NodeMultiFunctionBuilder &builder)
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
static void node_declare(NodeDeclarationBuilder &b)
static void chroma_matte(const float4 &color, const float4 &key, const float &minimum, const float &maximum, const float &falloff, float4 &result, float &matte)
static void node_register()
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void rgb_to_ycc(float r, float g, float b, float *r_y, float *r_cb, float *r_cr, int colorspace)
void cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static constexpr int _160
std::string ui_description
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
NodeDeclareFunction declare