18 b.add_input<
decl::Color>(
"Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
19#define SOCK_COLOR_ID 0
20 b.add_input<
decl::Float>(
"Density").default_value(1.0f).min(0.0f).max(1000.0f);
21#define SOCK_DENSITY_ID 1
28 "Directionality of the scattering. Zero is isotropic, negative is backward, "
29 "positive is forward");
35 .description(
"Index Of Refraction of the scattering particles");
41 .description(
"Fraction of light that is scattered backwards");
42 b.add_input<
decl::Float>(
"Alpha").default_value(0.5f).min(0.0f).max(500.0f);
47 .
description(
"Diameter of the water droplets, in micrometers");
64 const int phase_function = node->
custom1;
67 if (
STR_ELEM(sock->name,
"IOR",
"Backscatter")) {
71 else if (
STR_ELEM(sock->name,
"Anisotropy")) {
75 else if (
STR_ELEM(sock->name,
"Alpha")) {
78 else if (
STR_ELEM(sock->name,
"Diameter")) {
111 ntype.
ui_name =
"Volume Scatter";
113 "Scatter light as it passes through the volume, often used to add fog to a scene";
116 ntype.
declare = file_ns::node_declare;
120 ntype.
initfunc = file_ns::node_shader_init_scatter;
121 ntype.
gpu_fn = file_ns::node_shader_gpu_volume_scatter;
122 ntype.
updatefunc = file_ns::node_shader_update_scatter;
#define NODE_CLASS_SHADER
#define SH_NODE_VOLUME_SCATTER
#define LISTBASE_FOREACH(type, var, list)
#define BLT_I18NCONTEXT_ID_ID
@ SHD_PHASE_HENYEY_GREENSTEIN
@ SHD_PHASE_FOURNIER_FORAND
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_VOLUME_SCATTER
@ GPU_MATFLAG_VOLUME_ABSORPTION
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
void node_type_size_preset(bNodeType &ntype, eNodeSizePreset size)
static int node_shader_gpu_volume_scatter(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_update_scatter(bNodeTree *ntree, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_init_scatter(bNodeTree *, bNode *node)
static void node_shader_buts_scatter(uiLayout *layout, bContext *, PointerRNA *ptr)
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
bool object_shader_nodes_poll(const bContext *C)
bool node_socket_not_black(const GPUNodeStack &socket)
bool node_socket_not_zero(const GPUNodeStack &socket)
void register_node_type_sh_volume_scatter()
std::string ui_description
bool(* add_ui_poll)(const bContext *C)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)