14 b.use_custom_socket_order();
17 b.add_default_layout();
20 .default_value({0.617f, 0.577f, 0.540f, 1.0f})
21 .description(
"Color of the material");
23 .default_value({0.695f, 0.726f, 0.770f, 1.0f})
25 "Tint reflection at near-grazing incidence to simulate complex index of refraction");
27 .default_value({2.757f, 2.513f, 2.231f})
30 .
description(
"Real part of the conductor's refractive index, often called n");
32 .default_value({3.867f, 3.404f, 3.009f})
35 .
description(
"Imaginary part of the conductor's refractive index, often called k");
42 "Microfacet roughness of the surface (0.0 is a perfect mirror reflection, 1.0 is "
50 "Amount of anisotropy for reflection. Higher values give elongated highlights along the "
57 .description(
"Rotates the direction of anisotropy, with 1.0 going full circle");
68 .description(
"Thickness of the film in nanometers");
73 .
description(
"Index of refraction (IOR) of the thin film");
98 GPU_link(mat,
"world_normals_get", &
in[7].link);
102 if (use_complex_ior == 0.0f) {
103 if (
in[0].might_be_tinted() ||
in[1].might_be_tinted()) {
108 if (
in[2].might_be_tinted() ||
in[3].might_be_tinted()) {
115 "node_bsdf_metallic",
139 if (to_type_ != NodeItem::Type::BSDF) {
143 NodeItem
color = get_input_value(
"Base Color", NodeItem::Type::Color3);
144 NodeItem edge_tint = get_input_value(
"Edge Tint", NodeItem::Type::Color3);
145 NodeItem roughness = get_input_value(
"Roughness", NodeItem::Type::Vector2);
146 NodeItem anisotropy = get_input_value(
"Anisotropy", NodeItem::Type::Color3);
147 NodeItem normal = get_input_link(
"Normal", NodeItem::Type::Vector3);
148 NodeItem tangent = get_input_link(
"Tangent", NodeItem::Type::Vector3);
149 NodeItem thin_film_thickness = get_input_value(
"Thin Film Thickness", NodeItem::Type::Float);
150 NodeItem thin_film_ior = get_input_value(
"Thin Film IOR", NodeItem::Type::Float);
152 NodeItem ior_out, extinction_out;
154 ior_out = get_input_value(
"IOR", NodeItem::Type::Color3);
155 extinction_out = get_input_value(
"Extinction", NodeItem::Type::Color3);
158 NodeItem artistic_ior = create_node(
"artistic_ior",
159 NodeItem::Type::Multioutput,
160 {{
"reflectivity", color}, {
"edge_color", edge_tint}});
161 ior_out = artistic_ior.add_output(
"ior", NodeItem::Type::Color3);
162 extinction_out = artistic_ior.add_output(
"extinction", NodeItem::Type::Color3);
165 return create_node(
"conductor_bsdf",
166 NodeItem::Type::BSDF,
168 {
"tangent", tangent},
170 {
"extinction", extinction_out},
171 {
"roughness", roughness},
172 {
"thinfilm_thickness", thin_film_thickness},
173 {
"thinfilm_ior", thin_film_ior}});
188 ntype.
ui_name =
"Metallic BSDF";
189 ntype.
ui_description =
"Metallic reflection with microfacet distribution, and metallic fresnel";
192 ntype.
declare = file_ns::node_declare;
194 ntype.
draw_buttons = file_ns::node_shader_buts_metallic;
196 ntype.
initfunc = file_ns::node_shader_init_metallic;
197 ntype.
gpu_fn = file_ns::node_shader_gpu_bsdf_metallic;
198 ntype.
updatefunc = file_ns::node_shader_update_metallic;
#define NODE_CLASS_SHADER
#define SH_NODE_BSDF_METALLIC
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
@ GPU_MATFLAG_REFLECTION_MAYBE_COLORED
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
bool GPU_link(GPUMaterial *mat, const char *name,...)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
void node_type_size_preset(bNodeType &ntype, eNodeSizePreset size)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
bool object_shader_nodes_poll(const bContext *C)
NodeMaterialXFunction materialx_fn
std::string ui_description
bool(* add_ui_poll)(const bContext *C)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
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)