24 b.add_input<
decl::Color>(
"Image 1"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f});
25 b.add_input<
decl::Color>(
"Image 2"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f});
32 "If the average color difference between the two images is less than this threshold, "
40 "If the average color difference between the two images is less than this threshold, "
41 "it is partially keyed, otherwise, it is not keyed");
55 return GPU_stack_link(material,
node,
"node_composite_difference_matte", inputs, outputs);
60 const float &tolerance,
67 bool is_opaque = difference > tolerance + falloff;
68 float alpha = is_opaque ?
color.w :
80 return mf::build::SI4_SO2<Color, Color, float, float, Color, float>(
84 const float &tolerance,
87 float &matte) ->
void {
90 output_color =
Color(out_color);
92 mf::build::exec_presets::SomeSpanOrSingle<0, 1>());
101 ntype.
ui_name =
"Difference Key";
103 "Produce a matte that isolates foreground content by comparing it with a reference "
#define CMP_NODE_DIFF_MATTE
#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 safe_divide(const T &a, const T &b)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
static void difference_matte(const float4 &color, const float4 &key, const float &tolerance, const float &falloff, float4 &result, float &matte)
static void node_build_multi_function(nodes::NodeMultiFunctionBuilder &builder)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
NodeDeclareFunction declare