12 "Distance to displace the surface along the normal");
18 "Neutral displacement value that causes no displacement.\n"
19 "Lower values cause the surface to move inwards, "
20 "higher values push the surface outwards");
22 "Increase or decrease the amount of displacement");
39 GPU_link(mat,
"world_normals_get", &
in[3].link);
52 if (to_type_ != NodeItem::Type::DisplacementShader) {
57 NodeItem midlevel = get_input_value(
"Midlevel", NodeItem::Type::Float);
58 NodeItem height = get_input_value(
"Height", NodeItem::Type::Float) - midlevel;
59 NodeItem scale = get_input_value(
"Scale", NodeItem::Type::Float);
61 return create_node(
"displacement",
62 NodeItem::Type::DisplacementShader,
63 {{
"displacement", height}, {
"scale", scale}});
79 ntype.
ui_description =
"Displace the surface along the surface normal";
82 ntype.
declare = file_ns::node_declare;
83 ntype.
initfunc = file_ns::node_shader_init_displacement;
84 ntype.
gpu_fn = file_ns::gpu_shader_displacement;
#define NODE_CLASS_OP_VECTOR
#define SH_NODE_DISPLACEMENT
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
bool GPU_link(GPUMaterial *mat, const char *name,...)
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)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_displacement()
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
NodeMaterialXFunction materialx_fn
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
NodeDeclareFunction declare