29 N_(
"Desired number of voxels along one axis")},
34 N_(
"Desired voxel side length")},
35 {0,
nullptr, 0,
nullptr,
nullptr},
42 .
description(
"Mesh to convert the inner volume to a fog volume geometry");
47 .description(
"How the voxel size is specified")
65 .description(
"Width of the gradient inside of the mesh");
72 node->storage = MEM_new<NodeGeometryMeshToVolume>(__func__);
79 const float density = params.
get_input<
float>(
"Density"_ustr);
80 const float interior_band_width = params.
get_input<
float>(
"Interior Band Width"_ustr);
84 resolution.
mode = mode;
86 resolution.settings.voxel_amount = params.
get_input<
float>(
"Voxel Amount"_ustr);
87 if (resolution.settings.voxel_amount <= 0.0f) {
92 resolution.settings.voxel_size = params.
get_input<
float>(
"Voxel Size"_ustr);
93 if (resolution.settings.voxel_size <= 0.0f) {
104 const float voxel_size = geometry::volume_compute_voxel_size(
106 [&]() { return *mesh.bounds_min_max(); },
109 mesh_to_volume_space_transform);
114 geometry::fog_volume_grid_add_from_mesh(volume,
116 mesh.vert_positions(),
119 mesh_to_volume_space_transform,
135 Volume *volume = create_volume_from_mesh(*geometry_set.
get_mesh(), params);
140 params.
set_output(
"Volume"_ustr, std::move(geometry_set));
152 ntype.
ui_name =
"Mesh to Volume";
153 ntype.
ui_description =
"Create a fog volume with the shape of the input mesh's surface";
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_MESH_TO_VOLUME
#define CTX_N_(context, msgid)
#define BLT_I18NCONTEXT_ID_ID
#define BLT_I18NCONTEXT_COUNTABLE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
T extract_input(const UString identifier)
T get_input(const UString identifier) const
const Depsgraph * depsgraph() const
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_init(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static EnumPropertyItem resolution_mode_items[]
void node_geo_exec_with_missing_openvdb(GeoNodeExecParams ¶ms)
MatBase< float, 4, 4 > float4x4
void * BKE_id_new_nomain(short type, const char *name)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
MeshToVolumeModifierResolutionMode
@ MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT
@ MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_SIZE
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static MatBase identity()
void replace_volume(Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void keep_only(Span< GeometryComponent::Type > component_types)
const Mesh * get_mesh() const
static constexpr int _200
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
MeshToVolumeModifierResolutionMode mode