20#define SOCK_STRENGTH_ID 0
27 "Strength of the bump mapping effect, interpolating between "
28 "no bump mapping and full bump mapping")
30#define SOCK_DISTANCE_ID 1
32 .default_value(0.001f)
36 "Multiplier for the height value to control the overall distance for bump mapping");
37#define SOCK_FILTER_WIDTH_ID 2
44 "Filter width in pixels, used to compute the bump mapping direction. For most textures "
45 "the default value of 0.1 enables subpixel filtering for stable results. For stepwise "
46 "textures a larger filter width can be used to get a bevel like effect on the edges");
47#define SOCK_HEIGHT_ID 3
53 .description(
"Height above surface. Connect the height map texture to this input");
54#define SOCK_NORMAL_ID 4
73 return GPU_link(mat,
"world_normals_get", &
out[0].link);
105 NodeItem height = get_input_link(
"Height", NodeItem::Type::Float);
106 NodeItem normal = get_input_link(
"Normal", NodeItem::Type::Vector3);
111 "normal", NodeItem::Type::Vector3, {{
"space", val(std::string(
"world"))}});
116 NodeItem strength = get_input_value(
"Strength", NodeItem::Type::Float);
117 NodeItem
distance = get_input_value(
"Distance", NodeItem::Type::Float);
118 NodeItem height_normal = create_node(
119 "heighttonormal", NodeItem::Type::Vector3, {{
"in", height}, {
"scale", strength}});
121 return create_node(
"normalmap",
122 NodeItem::Type::Vector3,
123 {{
"in", height_normal},
125 {
"normal", normal}});
142 "Generate a perturbed normal from a height texture for bump mapping. Typically used for "
143 "faking highly detailed surfaces";
146 ntype.
declare = file_ns::node_declare;
148 ntype.
gpu_fn = file_ns::gpu_shader_bump;
#define NODE_CLASS_OP_VECTOR
#define BLT_I18NCONTEXT_AMOUNT
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
char * GPU_material_split_sub_function(GPUMaterial *material, GPUType return_type, GPUNodeLink **link)
GPUNodeLink * GPU_differentiate_float_function(const char *function_name, const float filter_width)
bool GPU_link(GPUMaterial *mat, const char *name,...)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
float distance(VecOp< float, D >, VecOp< float, D >) RET
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
void node_register_type(bNodeType &ntype)
static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_buts_bump(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
#define SOCK_FILTER_WIDTH_ID
void register_node_type_sh_bump()
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
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)