22#define SOCK_STRENGTH_ID 0
29 "Strength of the bump mapping effect, interpolating between "
30 "no bump mapping and full bump mapping")
32#define SOCK_DISTANCE_ID 1
34 .default_value(0.001f)
38 "Multiplier for the height value to control the overall distance for bump mapping");
39#define SOCK_FILTER_WIDTH_ID 2
46 "Filter width in pixels, used to compute the bump mapping direction. For most textures "
47 "the default value of 0.1 enables subpixel filtering for stable results. For stepwise "
48 "textures a larger filter width can be used to get a bevel like effect on the edges");
49#define SOCK_HEIGHT_ID 3
55 .description(
"Height above surface. Connect the height map texture to this input");
56#define SOCK_NORMAL_ID 4
115 NodeItem height = get_input_link(
"Height", NodeItem::Type::Float);
116 NodeItem normal = get_input_link(
"Normal", NodeItem::Type::Vector3);
121 "normal", NodeItem::Type::Vector3, {{
"space", val(std::string(
"world"))}});
126 NodeItem strength = get_input_value(
"Strength", NodeItem::Type::Float);
127 NodeItem
distance = get_input_value(
"Distance", NodeItem::Type::Float);
128 NodeItem height_normal = create_node(
129 "heighttonormal", NodeItem::Type::Vector3, {{
"in", height}, {
"scale", strength}});
131 return create_node(
"normalmap",
132 NodeItem::Type::Vector3,
133 {{
"in", height_normal},
135 {
"normal", normal}});
152 "Generate a perturbed normal from a height texture for bump mapping. Typically used for "
153 "faking highly detailed surfaces";
156 ntype.
declare = file_ns::node_declare;
158 ntype.
gpu_fn = file_ns::gpu_shader_bump;
#define NODE_CLASS_OP_VECTOR
#define BLT_I18NCONTEXT_AMOUNT
float distance(float, float) RET
float2x2 invert(float2x2 mat)
void node_register_type(bNodeType &ntype)
static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_bump(ui::Layout &layout, bContext *, PointerRNA *ptr)
@ ITEM_R_SPLIT_EMPTY_NAME
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_bump()
GPUNodeLink * GPU_constant(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
GPUNodeLink * GPU_differentiate_float_function(const char *function_name, const float filter_width)
GPUNodeLink * GPU_shading_data()
char * GPU_material_split_sub_function(GPUMaterial *material, GPUType return_type, GPUNodeLink **link)
GPUNodeLink * GPU_kernel_globals()
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
#define SOCK_FILTER_WIDTH_ID
NodeMaterialXFunction materialx_fn
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGPUExecFunction gpu_fn
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)