30 b.add_input<
decl::Color>(
"Image 1").default_value({1.0f, 1.0f, 1.0f, 1.0f});
31 b.add_input<
decl::Color>(
"Image 2").default_value({1.0f, 1.0f, 1.0f, 1.0f});
38 "If the average color difference between the two images is less than this threshold, "
46 "If the average color difference between the two images is less than this threshold, "
47 "it is partially keyed, otherwise, it is not keyed");
67 return mf::build::SI4_SO2<float4, float4, float, float, float4, float>(
71 const float &tolerance,
74 float &matte) ->
void {
77 bool is_opaque = difference > tolerance + falloff;
78 float alpha = is_opaque ?
85 mf::build::exec_presets::SomeSpanOrSingle<0, 1>());
98 ntype.
ui_name =
"Difference Key";
100 "Produce a matte that isolates foreground content by comparing it with a reference "
104 ntype.
declare = file_ns::cmp_node_diff_matte_declare;
106 ntype.
gpu_fn = file_ns::node_gpu_material;
#define CMP_NODE_DIFF_MATTE
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void construct_and_set_matching_fn_cb(Fn &&create_multi_function)
void node_register_type(bNodeType &ntype)
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_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
static void cmp_node_diff_matte_declare(NodeDeclarationBuilder &b)
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
VecBase< float, 4 > float4
VecBase< float, 3 > float3
static void register_node_type_cmp_diff_matte()
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
static blender::bke::bNodeSocketTemplate outputs[]
static blender::bke::bNodeSocketTemplate inputs[]
std::string ui_description
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
NodeDeclareFunction declare