23 b.use_custom_socket_order();
27 b.add_default_layout();
29 b.add_input<
decl::Color>(
"Color"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f});
40 .short_label(
"Anisotropy"_ustr)
42 "Amount of anisotropy for specular reflection. "
43 "Higher absolute values give elongated highlights along the tangent direction");
49 .description(
"Rotates the direction of anisotropy, with 1.0 going full circle");
50 b.add_input<
decl::Float>(
"IOR"_ustr).default_value(1.5f).min(0.0f).max(1000.0f);
53 b.add_input<
decl::Float>(
"Weight"_ustr).available(is_gpu_internal);
61 .description(
"Thickness of the film in nanometers");
66 .
description(
"Index of refraction (IOR) of the thin film");
91 if (
in[0].might_be_tinted()) {
111 if (to_type_ != NodeItem::Type::BSDF) {
115 NodeItem
color = get_input_value(
"Color", NodeItem::Type::Color3);
116 NodeItem roughness = get_input_value(
"Roughness", NodeItem::Type::Vector2);
117 NodeItem ior = get_input_value(
"IOR", NodeItem::Type::Float);
118 NodeItem normal = get_input_link(
"Normal", NodeItem::Type::Vector3);
119 NodeItem thin_film_thickness = get_input_value(
"Thin Film Thickness", NodeItem::Type::Float);
120 NodeItem thin_film_ior = get_input_value(
"Thin Film IOR", NodeItem::Type::Float);
122 return create_node(
"dielectric_bsdf",
123 NodeItem::Type::BSDF,
126 {
"roughness", roughness},
128 {
"thinfilm_thickness", thin_film_thickness},
129 {
"thinfilm_ior", thin_film_ior},
130 {
"scatter_mode", val(std::string(
"RT"))}});
146 ntype.
ui_description =
"Glass-like shader mixing refraction and reflection at grazing angles";
149 ntype.
declare = file_ns::node_declare;
154 ntype.
initfunc = file_ns::node_shader_init_glass;
155 ntype.
gpu_fn = file_ns::node_shader_gpu_bsdf_glass;
#define NODE_CLASS_SHADER
#define SH_NODE_BSDF_GLASS
DeclType::Builder & add_input(UString name, UString identifier=""_ustr)
void node_register_type(bNodeType &ntype)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_glass(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_shader_init_glass(bNodeTree *, bNode *node)
static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
@ ITEM_R_SPLIT_EMPTY_NAME
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
bool object_shader_nodes_poll(const bContext *C)
@ GPU_MATFLAG_REFLECTION_MAYBE_COLORED
@ GPU_MATFLAG_REFRACTION_MAYBE_COLORED
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
GPUNodeLink * GPU_constant(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
void search_link_ops_for_shader_bsdf_node(nodes::GatherLinkSearchOpParams ¶ms)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
void register_node_type_sh_bsdf_glass()
GPUNodeLink * GPU_shading_data()
@ NTREE_IS_GPU_SHADER_INTERNAL
GPUNodeLink * GPU_kernel_globals()
#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
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
bool(*) add_ui_poll(const bContext *C)
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)