18 b.add_input<
decl::Color>(
"Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
19 b.add_input<
decl::Float>(
"Scale").default_value(0.05f).min(0.0f).max(1000.0f);
20 b.add_input<
decl::Vector>(
"Radius").default_value({1.0f, 0.2f, 0.1f}).
min(0.0f).max(100.0f);
55 GPU_link(mat,
"world_normals_get", &in[6].link);
63 float use_sss = (use_subsurf) ? 1.0f : 0.0f;
72 const int sss_method = node->
custom1;
75 if (
STR_ELEM(sock->name,
"IOR",
"Anisotropy")) {
78 if (
STR_ELEM(sock->name,
"Roughness")) {
88 if (to_type_ != NodeItem::Type::BSDF) {
92 NodeItem
color = get_input_value(
"Color", NodeItem::Type::Color3);
93 NodeItem scale = get_input_value(
"Scale", NodeItem::Type::Float);
94 NodeItem radius = get_input_value(
"Radius", NodeItem::Type::Vector3);
95 NodeItem anisotropy = get_input_value(
"Anisotropy", NodeItem::Type::Float);
96 NodeItem normal = get_input_link(
"Normal", NodeItem::Type::Vector3);
98 return create_node(
"subsurface_bsdf",
100 {{
"weight", val(1.0f)},
102 {
"radius", radius *
scale},
103 {
"anisotropy", anisotropy},
120 ntype.
declare = file_ns::node_declare;
122 ntype.
draw_buttons = file_ns::node_shader_buts_subsurface;
124 ntype.
initfunc = file_ns::node_shader_init_subsurface_scattering;
125 ntype.
gpu_fn = file_ns::node_shader_gpu_subsurface_scattering;
126 ntype.
updatefunc = file_ns::node_shader_update_subsurface_scattering;
#define SH_NODE_SUBSURFACE_SCATTERING
#define NODE_CLASS_SHADER
#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
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
bool GPU_material_sss_profile_create(GPUMaterial *material, float radii[3])
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
bool GPU_link(GPUMaterial *mat, const char *name,...)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
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_register_type(bNodeType *ntype)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
static void node_shader_update_subsurface_scattering(bNodeTree *ntree, bNode *node)
static void node_shader_buts_subsurface(uiLayout *layout, bContext *, PointerRNA *ptr)
static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_init_subsurface_scattering(bNodeTree *, bNode *node)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_subsurface_scattering()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
bool object_shader_nodes_poll(const bContext *C)
bNodeRuntimeHandle * runtime
NodeMaterialXFunction materialx_fn
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)