13 b.add_input<
decl::Color>(
N_(
"Base Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
20 .default_value({1.0f, 0.2f, 0.1f})
24 b.add_input<
decl::Color>(
N_(
"Subsurface Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
85 b.add_input<
decl::Float>(
N_(
"IOR")).default_value(1.45f).min(0.0f).max(1000.0f);
96 b.add_input<
decl::Color>(
N_(
"Emission")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
97 b.add_input<
decl::Float>(
N_(
"Emission Strength")).default_value(1.0).min(0.0f).max(1000000.0f);
122 #define socket_not_zero(sock) (in[sock].link || (clamp_f(in[sock].vec[0], 0.0f, 1.0f) > 1e-5f))
123 #define socket_not_one(sock) \
124 (in[sock].link || (clamp_f(in[sock].vec[0], 0.0f, 1.0f) < 1.0f - 1e-5f))
134 GPU_link(mat,
"world_normals_get", &in[22].link);
139 GPU_link(mat,
"world_normals_get", &in[23].link);
146 GPU_link(mat,
"tangent_orco_z", orco, &in[24].link);
147 GPU_link(mat,
"node_tangent", in[24].link, &in[24].link);
167 if (use_transparency) {
176 if (use_diffuse ==
false && use_refract ==
false && use_clear ==
true) {
179 else if (use_diffuse ==
false && use_refract ==
false && use_clear ==
false) {
182 else if (use_diffuse ==
true && use_refract ==
false && use_clear ==
false) {
185 else if (use_diffuse ==
false && use_refract ==
true && use_clear ==
false) {
200 float use_sss = (use_subsurf) ? 1.0f : 0.0f;
201 float use_diffuse_f = (use_diffuse) ? 1.0f : 0.0f;
202 float use_clear_f = (use_clear) ? 1.0f : 0.0f;
203 float use_refract_f = (use_refract) ? 1.0f : 0.0f;
209 "node_bsdf_principled",
221 const int distribution =
node->custom1;
222 const int sss_method =
node->custom2;
225 if (
STREQ(sock->name,
"Transmission Roughness")) {
229 if (
STR_ELEM(sock->name,
"Subsurface IOR",
"Subsurface Anisotropy")) {
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
#define SH_NODE_BSDF_PRINCIPLED
void nodeSetSocketAvailability(struct bNodeTree *ntree, struct bNodeSocket *sock, bool is_available)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
#define NODE_CLASS_SHADER
void nodeRegisterType(struct bNodeType *ntype)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ SHD_SUBSURFACE_RANDOM_WALK
#define SHD_GLOSSY_MULTI_GGX
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
bool GPU_material_sss_profile_create(GPUMaterial *material, float radii[3])
GPUNodeLink * GPU_constant(const float *num)
@ GPU_MATFLAG_PRINCIPLED_GLASS
@ GPU_MATFLAG_PRINCIPLED_DIELECTRIC
@ GPU_MATFLAG_PRINCIPLED_CLEARCOAT
@ GPU_MATFLAG_PRINCIPLED_ANY
@ GPU_MATFLAG_TRANSPARENT
@ GPU_MATFLAG_PRINCIPLED_METALLIC
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_uniform(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
static void node_shader_buts_principled(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_update_principled(bNodeTree *ntree, bNode *node)
static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
#define socket_not_one(sock)
#define socket_not_zero(sock)
void register_node_type_sh_bsdf_principled()
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeDeclareFunction declare