33 const bool is_compositor =
b.tree_or_null() &&
b.tree_or_null()->type ==
NTREE_COMPOSIT;
40 "The coordinates at which Gabor noise will be evaluated. The Z component is ignored in "
45 .description(
"The scale of the Gabor noise");
50 "The rate at which the Gabor noise changes across space. This is different from the "
51 "Scale input in that it only scales perpendicular to the Gabor noise direction");
58 "The directionality of Gabor noise. 1 means the noise is completely directional, while "
59 "0 means the noise is omnidirectional");
61 const NodeGaborType gabor_type =
b.node_or_null() ? node_storage(*
b.node_or_null()).type :
63 b.add_input<
decl::Float>(
"Orientation"_ustr,
"Orientation 2D"_ustr)
67 .description(
"The direction of the anisotropic Gabor noise");
68 b.add_input<
decl::Vector>(
"Orientation"_ustr,
"Orientation 3D"_ustr)
69 .
default_value({std::numbers::sqrt2, std::numbers::sqrt2, 0.0f})
72 .description(
"The direction of the anisotropic Gabor noise");
76 "The Gabor noise value with both random intensity and phase. This is equal to sine the "
77 "phase multiplied by the intensity");
79 .
description(
"The phase of the Gabor noise, which has no random intensity");
81 .
description(
"The intensity of the Gabor noise, which has no random phase");
109 const float type =
float(node_storage(*node).type);
120 static std::array<mf::Signature, 2> signatures{
130 mf::SignatureBuilder builder{
"GaborNoise",
signature};
132 builder.single_input<
float3>(
"Vector");
133 builder.single_input<
float>(
"Scale");
134 builder.single_input<
float>(
"Frequency");
135 builder.single_input<
float>(
"Anisotropy");
138 builder.single_input<
float>(
"Orientation");
141 builder.single_input<
float3>(
"Orientation");
144 builder.single_output<
float>(
"Value", mf::ParamFlag::SupportsUnusedOutput);
145 builder.single_output<
float>(
"Phase", mf::ParamFlag::SupportsUnusedOutput);
146 builder.single_output<
float>(
"Intensity", mf::ParamFlag::SupportsUnusedOutput);
156 const VArray<float> &anisotropy = params.readonly_single_input<
float>(3,
"Anisotropy");
158 MutableSpan<float> r_value = params.uninitialized_single_output_if_required<
float>(5,
"Value");
159 MutableSpan<float> r_phase = params.uninitialized_single_output_if_required<
float>(6,
"Phase");
160 MutableSpan<float> r_intensity = params.uninitialized_single_output_if_required<
float>(
165 const VArray<float> &orientation = params.readonly_single_input<
float>(4,
"Orientation");
172 r_value.
is_empty() ?
nullptr : &r_value[i],
173 r_phase.is_empty() ?
nullptr : &r_phase[i],
174 r_intensity.is_empty() ?
nullptr : &r_intensity[i]);
186 r_value.
is_empty() ?
nullptr : &r_value[i],
187 r_phase.is_empty() ?
nullptr : &r_phase[i],
188 r_intensity.is_empty() ?
nullptr : &r_intensity[i]);
197 static constexpr int8_t id = 0;
226 ntype.
ui_name =
"Gabor Texture";
230 ntype.
declare = file_ns::sh_node_tex_gabor_declare;
231 ntype.
draw_buttons = file_ns::node_shader_buts_tex_gabor;
232 ntype.
initfunc = file_ns::node_shader_init_tex_gabor;
234 ntype.
gpu_fn = file_ns::node_shader_gpu_tex_gabor;
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_TEXTURE
#define SH_NODE_TEX_GABOR
const Signature & signature() const
void set_signature(const Signature *signature)
void construct_and_set_matching_fn(Args &&...args)
NodeDefaultInputType default_input_type
ExecutionHints get_execution_hints() const override
void hash_unique(UniqueHashBytes &hash) const override
GaborNoiseFunction(const NodeGaborType type)
static mf::Signature create_signature(const NodeGaborType type)
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
#define storage(slot, qualifiers)
float3x3 scale(float3x3 mat, float2 scale)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_shader_init_tex_gabor(bNodeTree *, bNode *node)
static void node_shader_buts_tex_gabor(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void sh_node_tex_gabor_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_tex_gabor(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
void gabor(const float2 coordinates, const float scale, const float frequency, const float anisotropy, const float orientation, float *r_value, float *r_phase, float *r_intensity)
@ ITEM_R_SPLIT_EMPTY_NAME
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *)
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void BKE_texture_mapping_default(struct TexMapping *texmap, int type)
void register_node_type_sh_tex_gabor()
@ NODE_DEFAULT_INPUT_POSITION_FIELD
@ NODE_DEFAULT_INPUT_UNIFORM_IMAGE_COORDINATES
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
VecBase< float, 3 > float3
void BKE_texture_colormapping_default(struct ColorMapping *colormap)
void common_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)