36 .
description(
"Strength of the normal mapping effect")
39 .default_value({0.5f, 0.5f, 1.0f, 1.0f})
40 .description(
"Color that encodes the normal map in the specified space");
60 layout.
prop_search(ptr,
"uv_map", &dataptr,
"uv_layers",
"", ICON_GROUP_UVS);
85 strength =
in[0].link;
93 newnormal =
in[1].link;
99 const char *color_to_normal_fnc_name =
"color_to_normal_new_shading";
101 color_to_normal_fnc_name =
"color_to_blender_normal_new_shading";
104 GPU_link(mat, color_to_normal_fnc_name, newnormal, &newnormal);
107 GPU_link(mat,
"color_invert_green_channel", newnormal, &newnormal);
111 "input_normal_displaced" :
112 "input_normal_original";
135 "normal_transform_object_to_world",
157 NodeItem
color = get_input_value(
"Color", NodeItem::Type::Vector3);
158 NodeItem strength = get_input_value(
"Strength", NodeItem::Type::Float);
161 NodeItem green_mask = val(MaterialX::Vector3(1.0f, -1.0f, 1.0f));
165# if MATERIALX_MAJOR_VERSION <= 1 && MATERIALX_MINOR_VERSION <= 38
167 switch (normal_map_node->
space) {
184 return create_node(
"normalmap",
185 NodeItem::Type::Vector3,
186 {{
"in", color}, {
"scale", strength}, {
"space", val(space)}});
189 return create_node(
"normalmap", NodeItem::Type::Vector3, {{
"in", color}, {
"scale", strength}});
194 NodeItem tangent = val(MaterialX::Vector3(1.0f, 0.0f, 0.0f));
195 NodeItem bitangent = val(MaterialX::Vector3(0.0f, 1.0f, 0.0f));
196 NodeItem normal = val(MaterialX::Vector3(0.0f, 0.0f, 1.0f));
198 return create_node(
"normalmap",
199 NodeItem::Type::Vector3,
202 {
"tangent", tangent},
203 {
"bitangent", bitangent},
204 {
"normal", normal}});
222 "Generate a perturbed normal from an RGB normal map image. Typically used for faking highly "
226 ntype.
declare = file_ns::node_declare;
227 ntype.
draw_buttons = file_ns::node_shader_buts_normal_map;
229 ntype.
initfunc = file_ns::node_shader_init_normal_map;
232 ntype.
gpu_fn = file_ns::gpu_shader_normal_map;
#define NODE_CLASS_OP_VECTOR
#define SH_NODE_NORMAL_MAP
#define BLT_I18NCONTEXT_AMOUNT
#define BLI_assert_unreachable()
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Object * get_space_editor_object(const bContext *C)
static int gpu_shader_normal_map(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_normal_map(ui::Layout &layout, bContext *C, PointerRNA *ptr)
static void node_shader_init_normal_map(bNodeTree *, bNode *node)
@ ITEM_R_SPLIT_EMPTY_NAME
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_id_pointer_create(ID *id)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
@ SHD_NORMAL_MAP_CONVENTION_DIRECTX
@ GPU_MATFLAG_OBJECT_INFO
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void register_node_type_sh_normal_map()
GPUNodeLink * GPU_uniform(const float *num)
@ SHD_NORMAL_MAP_BASE_DISPLACED
bool GPU_link(GPUMaterial *mat, const char *name,...)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
@ SHD_SPACE_BLENDER_WORLD
@ SHD_SPACE_BLENDER_OBJECT
GPUNodeLink * GPU_shading_data()
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
GPUNodeLink * GPU_kernel_globals()
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
static constexpr int _160
NodeMaterialXFunction materialx_fn
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGPUExecFunction gpu_fn
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
void prop_search(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, PropertyRNA *item_searchpropname, std::optional< StringRefNull > name, int icon, bool results_are_suggestions)
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)