21 node_storage(
node).dimensions = 1;
23 b.add_input<
decl::Float>(
N_(
"Scale")).
min(-1000.0f).max(1000.0f).default_value(5.0f);
30 b.add_input<
decl::Float>(
N_(
"Distortion")).
min(-1000.0f).max(1000.0f).default_value(0.0f);
52 BLI_assert(dimensions >= 1 && dimensions <= 4);
53 return std::array{
"node_noise_texture_1d",
54 "node_noise_texture_2d",
55 "node_noise_texture_3d",
56 "node_noise_texture_4d"}[dimensions - 1];
91 BLI_assert(dimensions >= 1 && dimensions <= 4);
92 static std::array<fn::MFSignature, 4> signatures{
105 if (
ELEM(dimensions, 2, 3, 4)) {
108 if (
ELEM(dimensions, 1, 4)) {
114 signature.single_input<
float>(
"Roughness");
115 signature.single_input<
float>(
"Distortion");
125 int param =
ELEM(dimensions_, 2, 3, 4) +
ELEM(dimensions_, 1, 4);
129 const VArray<float> &distortion =
params.readonly_single_input<
float>(param++,
"Distortion");
136 const bool compute_factor = !r_factor.is_empty();
137 const bool compute_color = !r_color.is_empty();
139 switch (dimensions_) {
142 if (compute_factor) {
144 const float position =
w[i] * scale[i];
146 position, detail[i],
roughness[i], distortion[i]);
151 const float position =
w[i] * scale[i];
153 position, detail[i],
roughness[i], distortion[i]);
161 if (compute_factor) {
165 position, detail[i],
roughness[i], distortion[i]);
172 position, detail[i],
roughness[i], distortion[i]);
180 if (compute_factor) {
184 position, detail[i],
roughness[i], distortion[i]);
191 position, detail[i],
roughness[i], distortion[i]);
200 if (compute_factor) {
203 const float position_w =
w[i] * scale[i];
205 position_vector[0], position_vector[1], position_vector[2], position_w};
207 position, detail[i],
roughness[i], distortion[i]);
213 const float position_w =
w[i] * scale[i];
215 position_vector[0], position_vector[1], position_vector[2], position_w};
217 position, detail[i],
roughness[i], distortion[i]);
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
#define NODE_STORAGE_FUNCS(StorageT)
void nodeSetSocketAvailability(struct bNodeTree *ntree, struct bNodeSocket *sock, bool is_available)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
struct bNodeSocket * nodeFindSocket(const struct bNode *node, eNodeSocketInOut in_out, const char *identifier)
#define NODE_CLASS_TEXTURE
void nodeRegisterType(struct bNodeType *ntype)
void BKE_texture_mapping_default(struct TexMapping *texmap, int type)
void BKE_texture_colormapping_default(struct ColorMapping *colormap)
#define TEXMAP_TYPE_POINT
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture SH_NODE_TEX_NOISE
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void set_signature(const MFSignature *signature)
const MFSignature & signature() const
void construct_and_set_matching_fn(Args &&...args)
ExecutionHints get_execution_hints() const override
static fn::MFSignature create_signature(int dimensions)
void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override
NoiseFunction(int dimensions)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node)
static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static void sh_node_noise_build_multi_function(NodeMultiFunctionBuilder &builder)
static const char * gpu_shader_get_name(const int dimensions)
static void node_shader_update_tex_noise(bNodeTree *ntree, bNode *node)
static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b)
float perlin_fractal_distorted(float position, float octaves, float roughness, float distortion)
float3 perlin_float3_fractal_distorted(float position, float octaves, float roughness, float distortion)
vec_base< float, 2 > float2
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken roughness("roughness", pxr::TfToken::Immortal)
void register_node_type_sh_tex_noise()
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *UNUSED(out))
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void sh_fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeMultiFunctionBuildFunction build_multi_function
NodeDeclareFunction declare