21 .
description(
"Distance to displace the surface along the normal");
27 "Neutral displacement value that causes no displacement.\n"
28 "Lower values cause the surface to move inwards, "
29 "higher values push the surface outwards");
34 .
description(
"Increase or decrease the amount of displacement");
65 if (to_type_ != NodeItem::Type::DisplacementShader) {
70 NodeItem midlevel = get_input_value(
"Midlevel", NodeItem::Type::Float);
71 NodeItem height = get_input_value(
"Height", NodeItem::Type::Float) - midlevel;
72 NodeItem
scale = get_input_value(
"Scale", NodeItem::Type::Float);
74 return create_node(
"displacement",
75 NodeItem::Type::DisplacementShader,
76 {{
"displacement", height}, {
"scale",
scale}});
92 ntype.
ui_description =
"Displace the surface along the surface normal";
95 ntype.
declare = file_ns::node_declare;
96 ntype.
initfunc = file_ns::node_shader_init_displacement;
97 ntype.
gpu_fn = file_ns::gpu_shader_displacement;
#define NODE_CLASS_OP_VECTOR
#define SH_NODE_DISPLACEMENT
float3x3 scale(float3x3 mat, float2 scale)
void node_register_type(bNodeType &ntype)
static void node_declare(NodeDeclarationBuilder &b)
static int gpu_shader_displacement(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_init_displacement(bNodeTree *, bNode *node)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void register_node_type_sh_displacement()
bool GPU_link(GPUMaterial *mat, const char *name,...)
GPUNodeLink * GPU_shading_data()
GPUNodeLink * GPU_kernel_globals()
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
NodeMaterialXFunction materialx_fn
std::string ui_description
NodeGPUExecFunction gpu_fn
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare