31 b.use_custom_socket_order();
32 b.allow_any_socket_order();
34 b.add_input<
decl::Color>(
"Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}).hide_value();
35 b.add_output<
decl::Color>(
"Image").align_with_previous();
43 .description(
"Pixels whose luminance values lower than this minimum are keyed");
49 .description(
"Pixels whose luminance values higher than this maximum are not keyed");
60 float luminance_coefficients[3];
65 "node_composite_luminance_matte",
73 float3 luminance_coefficients;
77 return mf::build::SI3_SO2<float4, float, float, float4, float>(
83 float &matte) ->
void {
85 float alpha =
math::clamp((luminance - minimum) / (maximum - minimum), 0.0f, 1.0f);
89 mf::build::exec_presets::SomeSpanOrSingle<0>());
102 ntype.
ui_name =
"Luminance Key";
103 ntype.
ui_description =
"Create a matte based on luminance (brightness) difference";
106 ntype.
declare = file_ns::cmp_node_luma_matte_declare;
108 ntype.
gpu_fn = file_ns::node_gpu_material;
#define CMP_NODE_LUMA_MATTE
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
BLI_INLINE void IMB_colormanagement_get_luminance_coefficients(float r_rgb[3])
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void construct_and_set_matching_fn_cb(Fn &&create_multi_function)
void node_register_type(bNodeType &ntype)
T clamp(const T &a, const T &min, const T &max)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T min(const T &a, const T &b)
static void cmp_node_luma_matte_declare(NodeDeclarationBuilder &b)
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
VecBase< float, 4 > float4
VecBase< float, 3 > float3
static void register_node_type_cmp_luma_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