19 .default_value({0.017513f, 0.005763f, 0.002059f, 1.0f})
20 .description(
"The RGB color of the strand. Only used in Direct Coloring");
26 .description(
"Hair pigment. Specify its absolute quantity between 0 and 1");
33 "Fraction of pheomelanin in melanin, gives yellowish to reddish color, as opposed to "
34 "the brownish to black color of eumelanin");
36 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
37 .description(
"Additional color used for dyeing the hair");
39 .default_value({0.245531f, 0.52f, 1.365f})
43 "Specifies energy absorption per unit length as light passes through the hair. A higher "
44 "value leads to a darker color");
51 "The ratio of the minor axis to the major axis of an elliptical cross-section. "
52 "Recommended values are 0.8~1 for Asian hair, 0.65~0.9 for Caucasian hair, 0.5~0.65 for "
53 "African hair. The major axis is aligned with the curve normal, which is not supported "
60 .description(
"Hair roughness. A low value leads to a metallic look");
72 "Simulate a shiny coat by reducing the roughness to the given factor only for the first "
73 "light bounce (diffuse). Range [0, 1] is equivalent to a reduction of [0%, 100%] of the "
74 "original roughness");
76 "Index of refraction determines how much the ray is bent. At 1.0 rays pass straight through "
77 "like in a transparent material; higher values cause larger deflection in angle. Default "
78 "value is 1.55 (the IOR of keratin)");
80 .default_value(2.0f *
float(
M_PI) / 180.0f)
85 "The tilt angle of the cuticle scales (the outermost part of the hair). They are always "
86 "tilted towards the hair root. The value is usually between 2 and 4 for human hair");
92 .description(
"Vary the melanin concentration for each strand");
98 .description(
"Vary roughness values for each strand");
107 "Optional factor for modulating the first light bounce off the hair surface. The color "
108 "of this component is always white. Keep this 1.0 for physical correctness");
115 "Optional factor for modulating the transmission component. Picks up the color of the "
116 "pigment inside the hair. Keep this 1.0 for physical correctness");
117 b.add_input<
decl::Float>(
"Secondary Reflection",
"TRT lobe")
123 "Optional factor for modulating the component which is transmitted into the hair, "
124 "reflected off the backside of the hair and then transmitted out of the hair. This "
125 "component is oriented approximately around the incoming direction, and picks up the "
126 "color of the pigment inside the hair. Keep this 1.0 for physical correctness");
144 node->storage =
data;
153 int model = data->model;
156 if (
STREQ(sock->name,
"Color")) {
160 else if (
STREQ(sock->name,
"Melanin")) {
164 else if (
STREQ(sock->name,
"Melanin Redness")) {
168 else if (
STREQ(sock->name,
"Tint")) {
172 else if (
STREQ(sock->name,
"Absorption Coefficient")) {
176 else if (
STREQ(sock->name,
"Random Color")) {
180 else if (
STREQ(sock->name,
"Radial Roughness")) {
183 else if (
STREQ(sock->name,
"Coat")) {
186 else if (
STREQ(sock->name,
"Aspect Ratio")) {
189 else if (
STR_ELEM(sock->name,
"Reflection",
"Transmission",
"Secondary Reflection")) {
203 return GPU_stack_link(mat, node,
"node_bsdf_hair_principled", in, out);
216 &ntype, SH_NODE_BSDF_HAIR_PRINCIPLED,
"Principled Hair BSDF",
NODE_CLASS_SHADER);
217 ntype.
declare = file_ns::node_declare;
219 ntype.
draw_buttons = file_ns::node_shader_buts_principled_hair;
221 ntype.
initfunc = file_ns::node_shader_init_hair_principled;
222 ntype.
updatefunc = file_ns::node_shader_update_hair_principled;
223 ntype.
gpu_fn = file_ns::node_shader_gpu_hair_principled;
#define NODE_CLASS_SHADER
#define LISTBASE_FOREACH(type, var, list)
@ SHD_PRINCIPLED_HAIR_HUANG
@ SHD_PRINCIPLED_HAIR_CHIANG
@ SHD_PRINCIPLED_HAIR_REFLECTANCE
@ SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION
@ SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
local_group_size(16, 16) .push_constant(Type b
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size)
void node_set_socket_availability(bNodeTree *ntree, bNodeSocket *sock, bool is_available)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
static void node_shader_init_hair_principled(bNodeTree *, bNode *node)
static int node_shader_gpu_hair_principled(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_update_hair_principled(bNodeTree *ntree, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_principled_hair(uiLayout *layout, bContext *, PointerRNA *ptr)
void register_node_type_sh_bsdf_hair_principled()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
bool object_cycles_shader_nodes_poll(const bContext *C)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
bool(* add_ui_poll)(const bContext *C)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)