20 #include "../node_shader_util.h"
25 {
SOCK_RGBA,
N_(
"Base Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
28 N_(
"Subsurface Radius"),
37 {
SOCK_RGBA,
N_(
"Subsurface Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
48 {
SOCK_FLOAT,
N_(
"IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
51 {
SOCK_RGBA,
N_(
"Emission"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
52 {
SOCK_FLOAT,
N_(
"Emission Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
54 {
SOCK_VECTOR,
N_(
"Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f,
PROP_NONE,
SOCK_HIDE_VALUE},
56 N_(
"Clearcoat Normal"),
65 {
SOCK_VECTOR,
N_(
"Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f,
PROP_NONE,
SOCK_HIDE_VALUE},
80 #define socket_not_zero(sock) (in[sock].link || (clamp_f(in[sock].vec[0], 0.0f, 1.0f) > 1e-5f))
81 #define socket_not_one(sock) \
82 (in[sock].link || (clamp_f(in[sock].vec[0], 0.0f, 1.0f) < 1.0f - 1e-5f))
94 GPU_link(mat,
"world_normals_get", &in[20].link);
99 GPU_link(mat,
"world_normals_get", &in[21].link);
106 GPU_link(mat,
"tangent_orco_z", orco, &in[22].link);
131 sss_scale = in[2].
link;
134 GPU_link(mat,
"set_rgb_one", &sss_scale);
148 float f_use_diffuse = use_diffuse ? 1.0f : 0.0f;
149 float f_use_clearcoat = use_clear ? 1.0f : 0.0f;
150 float f_use_refraction = use_refract ? 1.0f : 0.0f;
157 "node_bsdf_principled",
172 int distribution =
node->custom1;
174 for (sock =
node->inputs.first; sock; sock = sock->
next) {
175 if (
STREQ(sock->
name,
"Transmission Roughness")) {
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
#define SH_NODE_BSDF_PRINCIPLED
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)
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
#define NODE_CLASS_SHADER
void nodeRegisterType(struct bNodeType *ntype)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define SHD_GLOSSY_MULTI_GGX
GPUNodeLink * GPU_builtin(eGPUBuiltin builtin)
GPUNodeLink * GPU_attribute(GPUMaterial *mat, CustomDataType type, const char *name)
GPUNodeLink * GPU_constant(const float *num)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag)
void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3], const short *falloff_type, const float *sharpness)
bool GPU_link(GPUMaterial *mat, const char *name,...)
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
#define socket_not_one(sock)
#define socket_not_zero(sock)
static bNodeSocketTemplate sh_node_bsdf_principled_out[]
static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node)
static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node)
void register_node_type_sh_bsdf_principled(void)
static bNodeSocketTemplate sh_node_bsdf_principled_in[]
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
struct GPUNodeLink * link
Compact definition of a node socket.
struct bNodeSocket * next