17 b.add_input<
decl::Color>(
N_(
"Color1")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
18 b.add_input<
decl::Color>(
N_(
"Color2")).default_value({0.2f, 0.2f, 0.2f, 1.0f});
19 b.add_input<
decl::Color>(
N_(
"Mortar")).default_value({0.0f, 0.0f, 0.0f, 1.0f}).no_muted_links();
30 b.add_input<
decl::Float>(
N_(
"Mortar Smooth")).
min(0.0f).max(1.0f).no_muted_links();
80 if (
STREQ(sock->name,
"Mortar Smooth")) {
95 float offset_freq =
tex->offset_freq;
96 float squash_freq =
tex->squash_freq;
111 const int offset_freq_;
113 const int squash_freq_;
117 const int offset_freq,
119 const int squash_freq)
120 : offset_(
offset), offset_freq_(offset_freq), squash_(squash), squash_freq_(squash_freq)
134 signature.single_input<
float>(
"Mortar Size");
135 signature.single_input<
float>(
"Mortar Smooth");
137 signature.single_input<
float>(
"Brick Width");
138 signature.single_input<
float>(
"Row Height");
147 n = (n + 1013) & 0x7fffffff;
149 const uint nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
150 return 0.5f * ((
float)nn / 1073741824.0f);
155 const float ff = f * f;
156 return (3.0f * ff - 2.0f * ff * f);
166 int offset_frequency,
168 int squash_frequency)
172 const int rownum = (int)
floorf(p.y / row_height);
174 if (offset_frequency && squash_frequency) {
175 brick_width *= (rownum % squash_frequency) ? 1.0f : squash_amount;
176 offset = (rownum % offset_frequency) ? 0.0f : (brick_width * offset_amount);
179 const int bricknum = (int)
floorf((p.x +
offset) / brick_width);
181 const float x = (p.x +
offset) - brick_width * bricknum;
182 const float y = p.y - row_height * rownum;
185 brick_noise((rownum << 16) + (bricknum & 0xFFFF)) + bias, 0.0f, 1.0f);
189 if (min_dist >= mortar_size) {
192 else if (mortar_smooth == 0.0f) {
196 min_dist = 1.0f - min_dist / mortar_size;
197 mortar = (min_dist < mortar_smooth) ?
smoothstepf(min_dist / mortar_smooth) : 1.0f;
200 return float2(tint, mortar);
214 const VArray<float> &mortar_smooth =
params.readonly_single_input<
float>(6,
"Mortar Smooth");
223 const bool store_fac = !r_fac.is_empty();
224 const bool store_color = !r_color.is_empty();
238 float4 color_data, color1, color2, mortar;
243 const float tint = f2.x;
244 const float f = f2.y;
247 const float facm = 1.0f - tint;
248 color_data = color1 * facm + color2 * tint;
252 color_data = color_data * (1.0f - f) + mortar * f;
typedef float(TangentPoint)[2]
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
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))
#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 LISTBASE_FOREACH(type, var, list)
MINLINE float clamp_f(float value, float min, float max)
MINLINE void copy_v4_v4(float r[4], const float a[4])
#define TEXMAP_TYPE_POINT
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
GPUNodeLink * GPU_constant(const float *num)
GPUNodeLink * GPU_uniform(const float *num)
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 Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells SH_NODE_TEX_BRICK
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void set_signature(const MFSignature *signature)
const MFSignature & signature() const
void construct_and_set_matching_fn(Args &&...args)
static float brick_noise(uint n)
BrickFunction(const float offset, const int offset_freq, const float squash, const int squash_freq)
static float smoothstepf(const float f)
void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override
static fn::MFSignature create_signature()
static float2 brick(float3 p, float mortar_size, float mortar_smooth, float bias, float brick_width, float row_height, float offset_amount, int offset_frequency, float squash_amount, int squash_frequency)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static int node_shader_gpu_tex_brick(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node)
static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void sh_node_brick_build_multi_function(NodeMultiFunctionBuilder &builder)
static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b)
vec_base< float, 2 > float2
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_sh_tex_brick()
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