#include <volumetools.h>
VolumeToolsInterface provides methods to process volumes.
Static Public Member Functions | |
static MAXON_METHOD Result< BaseArray< String > > | GetGridNamesFromFile (const Url &filename) |
static MAXON_METHOD Result< DataDictionary > | GetMetaDataFromFile (const Url &filename) |
static MAXON_METHOD Result< BaseArray< Volume > > | LoadVDBFile (const Url &filename, Float scale, BaseArray< String > *gridNames=nullptr, const BaseArray< Int > *gridIndices=nullptr, DataDictionary *metaData=nullptr) |
static MAXON_METHOD Result< void > | LoadGridIntoVolume (const Url &filename, Float scale, Int gridIndex, Volume &volume, DataDictionary *metaData=nullptr) |
static MAXON_METHOD Result< void > | LoadAllGridsIntoVolumes (const Url &filename, Float scale, maxon::BaseArray< Volume > &volume, DataDictionary *metaData=nullptr) |
static MAXON_METHOD Result< void > | SaveVDBFile (const Url &filename, Float scale, BaseArray< Volume > &volumes, const DataDictionary &metaData=DataDictionary()) |
static MAXON_METHOD Result< Volume > | BoolVolumes (const Volume &volumeOne, const Volume &volumeTwo, BOOLTYPE type) |
static MAXON_METHOD Result< Volume > | MixVolumes (const Volume &volumeOne, const Volume &volumeTwo, MIXTYPE type) |
static MAXON_METHOD Result< PolygonObject * > | VolumeToMesh (const Volume &volume, Float iso, Float adaptiveValue) |
static MAXON_METHOD Result< Volume > | MeshToVolume (const Block< Vector > &vertices, const Block< VolumeConversionPolygon > &polygons, Matrix polygonObjectMatrix, Float gridSize, Int32 bandWidthInterior, Int32 bandWidthExterior, const ThreadRef &checkForCancellation, POLYGONCONVERSIONFLAGS conversionSettings=POLYGONCONVERSIONFLAGS::NONE, const Matrix *creationTransform=nullptr) |
static MAXON_METHOD Result< Volume > | GeometryObjectToVolume (const Geometry &geometry, Matrix polygonObjectMatrix, Float gridSize, Int32 bandWidthInterior, Int32 bandWidthExterior, const ThreadRef &checkForCancellation, POLYGONCONVERSIONFLAGS conversionSettings=POLYGONCONVERSIONFLAGS::NONE, const Matrix *creationTransform=nullptr) |
static MAXON_METHOD Result< Volume > | PointsToVolume (const DelegatePointObjectsPairList &pointObjects, Float gridSize, Int32 bandWidth, const ThreadRef &checkForCancellation, const Matrix *creationTransform=nullptr, Float velocityScale=0.0) |
static MAXON_METHOD Result< Volume > | ApplySDFFilterToVolume (const Volume &volume, const SDFFilterSettings &filterType, const ThreadRef &checkForCancellation, const Volume *maskVolume=nullptr, FieldSampleData *maskField=nullptr) |
static MAXON_METHOD Result< Volume > | ApplyFilterToVolume (const Volume &volume, const FilterSettings &filterType, const ThreadRef &checkForCancellation, const Volume *maskVolume=nullptr, FieldSampleData *maskField=nullptr) |
static MAXON_METHOD Result< Volume > | ConvertFieldsToVolume (FieldSampleData &fieldData, Float gridSize, const Range< Vector > &sampleBox, const ThreadRef &checkForCancellation, const Volume *volumeReference=nullptr, const Matrix *creationTransform=nullptr) |
static MAXON_METHOD Result< Volume > | ConvertSDFToFog (const Volume &volume, Float cutoff=LIMIT< Float >::MAX) |
static MAXON_METHOD Result< Volume > | ConvertFogToSDF (const Volume &volume, Float iso, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | ResampleVolume (const Volume &volume, const Matrix &resampleTransform, const RESAMPLEINTERPOLATIONTYPE interpolationType, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | CreateMaskFromField (FieldSampleData &fieldData, const Volume &volumeReference, Float background, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | CreateNewFloat32Volume (Float32 background) |
static MAXON_METHOD Result< Volume > | CreateGradientVolume (const Volume &volume, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | CreateSphereVolume (Float radius, const Vector &position, Float gridSize, Int32 bandWidth, const ThreadRef &checkForCancellation, const Matrix *creationTransform=nullptr) |
static MAXON_METHOD Result< Volume > | CreatePlatonicVolume (Int32 sides, Float size, const Vector &position, Float gridSize, Int32 bandWidth, const ThreadRef &checkForCancellation, const Matrix *creationTransform=nullptr) |
static MAXON_METHOD Result< Volume > | CreateNewVector32Volume (Vector32 background) |
static MAXON_METHOD Result< Volume > | MixVectorVolumes (const Volume &volumeOne, const Volume &volumeTwo, MIXVECTORTYPE type) |
static MAXON_METHOD Result< Volume > | ConvertFieldsToVectorVolume (FieldSampleData &fieldData, Float gridSize, const Range< Vector > &sampleBox, const ThreadRef &checkForCancellation, const Volume *volumeReference=nullptr, const Matrix *creationTransform=nullptr) |
static MAXON_METHOD Result< Volume > | NormalizeVectorVolume (const Volume &volume, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | CreateCurlVolume (const Volume &volume, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | CreateMeanCurvatureVolume (const Volume &volume, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | RotateVectorVolume (const Volume &volume, const Vector &rotationAxis, const Float angle, const ThreadRef &checkForCancellation, FieldSampleData *maskField=nullptr) |
static MAXON_METHOD Result< Volume > | ConvertVectorToFog (const Volume &volume, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | BlendVolumes (const Volume &volumeA, const Volume &volumeB, const Float blendValue, const ThreadRef &checkForCancellation) |
static MAXON_METHOD Result< Volume > | SmoothBoolVolumes (const Volume &volumeOne, const Volume &volumeTwo, BOOLTYPE type, Float radius) |
static MAXON_METHOD Result< Array< Vector > > | ScatterPointsInVolume (const Volume &volume, UInt64 pointCount, Float spread, Int seed) |
static MAXON_METHOD Result< BaseArray< UInt32 > > | GetNanoVDBCopy (const Volume &volume, NANOVDBPRECISION precision=NANOVDBPRECISION::FP16) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (VolumeToolsInterface, MAXON_REFERENCE_STATIC, "net.maxon.volume.interface.volumetools") | |
|
private |
|
static |
Read and return the gridnames from a .vdb file.
[in] | filename | The url of the file. |
|
static |
Read and return the metadata from a .vdb file.
[in] | filename | The url of the file. |
|
static |
Loads volumes from a .vdb file.
[in] | filename | The url of the file to load from. |
[in] | scale | A scale factor for loading the grids. |
[out] | gridNames | If a BaseArray is passed, it will be filled with the grid names. |
[in] | gridIndices | Optional list of indices that should be loaded from the file. |
[out] | metaData | If passed, will be filled with the metadata from the file. |
|
static |
Loads a grid into a volume from a .vdb file.
[in] | filename | The url of the file to load from. |
[in] | scale | A scale factor for loading the grids. |
[in] | gridIndex | The index of the grid in the .vdb file. |
[out] | volume | The volume reference to load the grid into. |
[out] | metaData | If passed, will be filled with the metadata from the file. |
|
static |
Loads all grids into a list of volumes from a .vdb file.
[in] | filename | The url of the file to load from. |
[in] | scale | A scale factor for loading the grids. |
[out] | volume | The output list of loaded volumes. |
[out] | metaData | If passed, will be filled with the metadata from the file. |
|
static |
Saves volumes to a .vdb file.
[in] | filename | The url of the file to save to. |
[in] | scale | A scale factor for saving the grids. |
[in] | volumes | A list of volumes that should be saved to the .vdb file. |
[in] | metaData | Optional Metadata to write to the file. Have to be added under string keys to the data dictionary. |
|
static |
|
static |
|
static |
Extracts a polygon object iso surface from a volume. This is done by a marching cube algorithm.
[in] | volume | The volume to extract a surface from. |
[in] | iso | The iso value at which a surface should be extracted. |
[in] | adaptiveValue | An adaptive value between 0.0 and 1.0 that reduces the polygon count based on curvature. |
|
static |
Converts a polygon object to a SDF volume.
[in] | vertices | The vertex positions of the polygon object. |
[in] | polygons | The polygon information. This needs to be a list of ::VolumeConversionPolygon |
[in] | polygonObjectMatrix | The global position, scale and rotation matrix of the polygon object. |
[in] | gridSize | The desired gridsize of the created volume. |
[in] | bandWidthInterior | The amount of exterior voxels that distance information is calculated for. |
[in] | bandWidthExterior | The amount of interior voxels that distance information is calculated for. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | conversionSettings | Optional settings for the conversion to Volume POLYGONCONVERSIONFLAGS. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
|
static |
Converts a GeometryObject to a SDF volume.
[in] | geometry | The geometry object wrapper. |
[in] | polygonObjectMatrix | The global position, scale and rotation matrix of the polygon object. |
[in] | gridSize | The desired gridsize of the created volume. |
[in] | bandWidthInterior | The amount of exterior voxels that distance information is calculated for. |
[in] | bandWidthExterior | The amount of interior voxels that distance information is calculated for. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | conversionSettings | Optional settings for the conversion to Volume POLYGONCONVERSIONFLAGS. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
|
static |
Converts points in space to a SDF volume. This can be used to convert particles, vertices, spline sampling points or other points to a volume.
[in] | pointObjects | A list of Delegate/Object pairs that specify how to get point positions from the object. |
[in] | gridSize | The desired gridsize of the created volume. |
[in] | bandWidth | The amount of voxels around the creates spheres that distance information is calculated for. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
[in] | velocityScale | A velocity scale that the volumes will be extended to if they have a direction set. |
|
static |
Applies a filter operation to a SDF volume. This work only on SDF volumes.
[in] | volume | The volume that should be filtered. |
[in] | filterType | Settings for the filter operation. See ::SDFFilterSettings. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | maskVolume | An optional volume object to be used as mask. |
[in] | maskField | An optional field data struct to be used as field mask. |
|
static |
Applies a filter operation to a volume.
[in] | volume | The volume that should be filtered. |
[in] | filterType | Settings for the filter operation. See ::FilterSettings. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | maskVolume | An optional volume object to be used as mask. |
[in] | maskField | An optional field data struct to be used as field mask. |
|
static |
Convert a field list or a field object into a volume. This can either be done in a box that samples the grid fully or with a volume reference. In case of a volume the active voxels of the volume will be sampled and the result will have the same structure as the reference volume. Note that FieldSampleData can have information for a field list or a field object. If FieldSampleData's fieldOwner is a field object, fieldList can be nullptr.
[in] | fieldData | A data struct about the fieldlist data. |
[in] | gridSize | The voxel size of the resulting volume. |
[in] | sampleBox | A bounding box. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | volumeReference | An optional volume object that will define the sampling positions by it's active voxels. If this is used the voxelSize and sampleBox are ignored. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
|
static |
Convert a SDF Volume to a fog volume. The interiour of the SDF object will be filled with data ranging from 0.0 to 1.0 with a falloff.
[in] | volume | The SDF volume that should be converted. |
[in] | cutoff | The distance for the falloff from 0.0 (SDF 0.0 value) to 1.0. |
|
static |
Convert a fog Volume to a SDF volume. The resulting surface of the SDF volume is defined by the passed iso value.
[in] | volume | The fog volume that should be converted. |
[in] | iso | The iso value at which the surface should be created. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Resample a volume into a new transformation matrix.
[in] | volume | The volume that should be resampled. |
[in] | resampleTransform | The transformation matrix in which the volume should be resampled into. |
[in] | interpolationType | The resample interpolation type. See RESAMPLEINTERPOLATIONTYPE. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Creates a volume mask for a volume reference with values sampled from a field.
[in] | fieldData | A data struct about the fieldlist data. |
[in] | volumeReference | The reference volume that samples the field into the mask. |
[in] | background | The background of the mask. This will become the maskvalue in areas that have no active voxel in the volumeReference. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Creates a new float volume with default transform. The gridtype will be GRIDCLASS::UNKNOWN.
[in] | background | The background value for the volume. |
|
static |
Creates a gradient volume from a numeric volume.
[in] | volume | The numeric volume. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Creates a SDF volume of a spherical shape.
[in] | radius | The radius of the created sphere. |
[in] | position | The position of the sphere. |
[in] | gridSize | The desired gridsize of the created volume. |
[in] | bandWidth | The amount of interior and exterior voxels that distance information is calculated for. Should be greater than 1. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
|
static |
Creates a SDF volume of a platonic shape. If invalid Arguments are set the function returns an empty volume
[in] | sides | The number of sides of the platonic. Define the valid Arguments in the description of the parameter |
[in] | size | The size of the created platonic. |
[in] | position | The position of the platonic. |
[in] | gridSize | The desired gridsize of the created volume. |
[in] | bandWidth | The amount of interior and exterior voxels that distance information is calculated for. Should be greater than 1. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
|
static |
Creates a new float vector volume with default transform. The gridtype will be GRIDCLASS::UNKNOWN.
[in] | background | The background vector value for the volume. |
|
static |
Mix two vector volumes into one with a given mix type of MIXVECTORTYPE.
[in] | volumeOne | The first vector volume for the mix operation. |
[in] | volumeTwo | The second vector volume for the mix operation. |
[in] | type | The mix type MIXVECTORTYPE. |
|
static |
Convert a field lists directional channel or a field object into a vector volume. This can either be done in a box that samples the grid fully or with a volume reference. In case of a volume the active voxels of the volume will be sampled and the result will have the same structure as the reference volume. Note that FieldSampleData can have information for a field list or a field object. If FieldSampleData's fieldOwner is a field object, fieldList can be nullptr.
[in] | fieldData | A data struct about the fieldlist data. |
[in] | gridSize | The voxel size of the resulting volume. |
[in] | sampleBox | A bounding box. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | volumeReference | An optional volume object that will define the sampling positions by it's active voxels. If this is used the voxelSize and sampleBox are ignored. |
[in] | creationTransform | An optional override to the target grid matrix. If this is used the gridSize is ignored. |
|
static |
Creates a normalized vector volume from an input vector volume.
[in] | volume | The vector volume that should be normalized. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Creates a vector volume representing the curl of a vector volume.
[in] | volume | The vector volume the curl should be calculated from. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Creates a curvature volume from a numeric volume.
[in] | volume | The numeric volume. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Rotate the vectors of a vector volume by a specified angle around a rotation axis.
[in] | volume | The vector volume to rotate. |
[in] | rotationAxis | The rotation axis to rotate around. |
[in] | angle | The angle in radians to rotate. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
[in] | maskField | An optional field data struct to be used as field mask. |
|
static |
Convert a vector volume to a fog volume. The resulting volume will have the length of the vectors stored at the original voxel position.
[in] | volume | The fog volume that should be converted. |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Does a linear blend operation of two volume grids. Both grids need to have the same type and this type needs to be blendable.
[in] | volumeA | The first volume of the blend operation. |
[in] | volumeB | The second volume of the blend operation. |
[in] | blendValue | The linear blend value between A and B. 1.0 results in A, 0.0 in B |
[in] | checkForCancellation | A thread reference that cancellation is tested against. |
|
static |
Smooth Bools two SDF volumes into one with a given bool type of BOOLTYPE.
[in] | volumeOne | The first SDF volume for the boolean operation. |
[in] | volumeTwo | The second SDF volume for the boolean operation. |
[in] | type | The bool type BOOLTYPE. |
[in] | radius | The radius of the smoothing area around the overlapping parts. |
|
static |
Scatters points inside of Fog volume
[in] | volume | The fog volume to scatter points in |
[in] | pointCount | The number of points to scatter |
[in] | spread | The spread of the scattered points |
|
static |
Converts the internal data to the nanovdb format and returns it in nanoVDBData. If the underyling GRIDTYPE is FLOAT or DOUBLE - returns a converted volume of type nanovdb::Fp16 by default.
If the underyling GRIDTYPE is VECTOR32 or VECTOR64 - returns a converted volume of type nanovdb::Vec3<float> by default. Note that if the GRIDTYPE is VECTOR32 the resulting velocity vector has to be mirrored along the xy plane (.z *= -1.0f).
[in] | precision | The precision returned - only FLOAT available for vector grids. |