22 b.add_input<
decl::Color>(
"Color"_ustr).default_value({0.5f, 0.5f, 0.5f, 1.0f});
23#define SOCK_COLOR_ID 0
25#define SOCK_COLOR_ATTR_ID 1
26 b.add_input<
decl::Float>(
"Density"_ustr).default_value(1.0f).min(0.0f).max(1000.0f);
27#define SOCK_DENSITY_ID 2
28 b.add_input<
decl::String>(
"Density Attribute"_ustr).default_value(
"density");
29#define SOCK_DENSITY_ATTR_ID 3
35#define SOCK_ANISOTROPY_ID 4
36 b.add_input<
decl::Color>(
"Absorption Color"_ustr).default_value({0.0f, 0.0f, 0.0f, 1.0f});
37#define SOCK_ABSORPTION_COLOR_ID 5
38 b.add_input<
decl::Float>(
"Emission Strength"_ustr).default_value(0.0f).min(0.0f).max(1000.0f);
39#define SOCK_EMISSION_ID 6
40 b.add_input<
decl::Color>(
"Emission Color"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f});
41#define SOCK_EMISSION_COLOR_ID 7
47#define SOCK_BLACKBODY_INTENSITY_ID 8
48 b.add_input<
decl::Color>(
"Blackbody Tint"_ustr).default_value({1.0f, 1.0f, 1.0f, 1.0f});
49#define SOCK_BLACKBODY_TINT_ID 8
51 .default_value(1000.0f)
55 b.add_input<
decl::String>(
"Temperature Attribute"_ustr).default_value(
"temperature");
56 b.add_input<
decl::Float>(
"Weight"_ustr).available(is_gpu_internal);
61 const char *attribute_name,
64 if (
STREQ(attribute_name,
"color")) {
67 else if (
STREQ(attribute_name,
"temperature")) {
69 mat,
"node_attribute_temperature",
GPU_kernel_globals(), *attribute_link, attribute_link);
100 const char *attribute_name = value->
value;
101 if (attribute_name[0] ==
'\0') {
105 if (
STREQ(sock.
name,
"Density Attribute")) {
109 else if (
STREQ(sock.
name,
"Color Attribute")) {
113 else if (use_blackbody &&
STREQ(sock.
name,
"Temperature Attribute")) {
120 static const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
145 "node_volume_principled",
158#undef SOCK_COLOR_ATTR_ID
159#undef SOCK_DENSITY_ID
160#undef SOCK_DENSITY_ATTR_ID
161#undef SOCK_ANISOTROPY_ID
162#undef SOCK_ABSORPTION_COLOR_ID
163#undef SOCK_EMISSION_ID
164#undef SOCK_EMISSION_COLOR_ID
165#undef SOCK_BLACKBODY_INTENSITY_ID
166#undef SOCK_BLACKBODY_TINT_ID
178 ntype.
ui_name =
"Principled Volume";
179 ntype.
ui_description =
"Combine all volume shading components into a single easy to use node";
182 ntype.
declare = file_ns::node_declare;
185 ntype.
gpu_fn = file_ns::node_shader_gpu_volume_principled;
#define NODE_CLASS_SHADER
#define SH_NODE_VOLUME_PRINCIPLED
#define BLT_I18NCONTEXT_ID_ID
void node_register_type(bNodeType &ntype)
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_volume_principled(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void attribute_post_process(GPUMaterial *mat, const char *attribute_name, GPUNodeLink **attribute_link)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
GPUNodeLink * GPU_attribute_with_default(GPUMaterial *mat, eCustomDataType type, const char *name, GPUDefaultValue default_value)
void register_node_type_sh_volume_principled()
@ GPU_MATFLAG_VOLUME_ABSORPTION
@ GPU_MATFLAG_VOLUME_SCATTER
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
GPUNodeLink * GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *r_row)
GPUNodeLink * GPU_constant(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
BMesh const char void * data
void search_link_ops_for_shader_bsdf_node(nodes::GatherLinkSearchOpParams ¶ms)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_shading_data()
void IMB_colormanagement_blackbody_temperature_to_rgb_table(float *r_table, int width, float min, float max)
@ NTREE_IS_GPU_SHADER_INTERNAL
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
GPUNodeLink * GPU_kernel_globals()
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
#define SOCK_ABSORPTION_COLOR_ID
#define SOCK_BLACKBODY_INTENSITY_ID
bke::bNodeSocketType * typeinfo
static constexpr int _240
std::string ui_description
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare