maxon.frameworks.volume.VolumeToolsInterface¶
Description¶
maxon.frameworks.volume.VolumeToolsInterface
provides methods to process volumes.
Inheritance diagram¶
Methods Signature¶
ApplyFilterToVolume (volume, filterType, thread) |
Applies a filter operation to any volume. |
ApplySDFFilterToVolume (volume, filterType, …) |
Applies a filter operation to a SDF volume. |
BoolVolumes (voumeOne, volumeTwo, type) |
Bools two SDF volumes into one with a given bool type of maxon.BOOLTYPE . |
ConvertFogToSDF (volume, iso, thread) |
Convert a fog Volume to a SDF volume. |
ConvertSDFToFog (volume, cutoff) |
Convert a SDF Volume to a fog volume. |
ConvertVectorToFog (volume, thread) |
Convert a vector volume to a fog volume. |
CreateCurlVolume (volume, thread) |
Creates a vector volume representing the curl of a vector volume. |
CreateGradientVolume (volume, thread) |
Creates a gradient volume from a numeric volume. |
CreateMeanCurvatureVolume (*args) |
NormalizeVectorVolume(volume, thread) Creates a curvature volume from a numeric volume. |
CreateNewFloat32Volume (background) |
Creates a new float volume with default transform. |
CreateNewVector32Volume (background) |
Creates a new float vector volume with default transform. |
CreatePlatonicVolume (sides, size, position, …) |
Creates a SDF volume of a platonic shape. |
CreateSphereVolume (radius, position, …[, …]) |
Creates a SDF volume of a spherical shape. |
GetGridNamesFromFile (filename) |
Read and return the gridnames from a .vdb file. |
GetMetaDataFromFile (filename) |
Read and return the metadata from a .vdb file. |
LoadAllGridsIntoVolumes (filename, scale, …) |
Loads all grids into a list of volumes from a .vdb file. |
LoadGridIntoVolume (filename, scale, …) |
Loads a grid into a volume from a .vdb file. |
LoadVDBFile (filename, scale, gridNames, …) |
Loads volumes from a .vdb file. |
MeshToVolume (vertices, polygons, …[, …]) |
Converts a polygon object to a SDF volume. |
MixVectorVolumes (volumeOne, volumeTwo, type) |
Mix two volumes into one with a given mix type of maxon.MIXVECTORTYPE . |
MixVolumes (volumeOne, volumeTwo, type) |
Mix two volumes into one with a given mix type of maxon.MIXTYPE . |
NormalizeVectorVolume (volume, thread) |
Creates a normalized vector volume from an input vector volume. |
PointsToVolume (pointObjects, gridSize, …) |
Converts points in space to a SDF volume.
|
ResampleVolume (volume, resampleTransform, …) |
Resample a volume into a new transformation matrix. |
RotateVectorVolume (volume, rotationAxis, …) |
Rotate the vectors of a vector volume by a specified angle around a rotation axis. |
SaveVDBFile (filename, scale, volumes, metaData) |
Saves volumes to a .vdb file. |
VolumeToMesh (volume, iso, adaptiveValue) |
Extracts a polygon object iso surface from a volume. |
Methods Definition¶
-
static
VolumeToolsInterface.
ApplyFilterToVolume
(volume, filterType, thread, maskVolume=None, maskField=None)¶ Applies a filter operation to any volume.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The volume that should be filtered. - filterType (
maxon.frameworks.volume.FilterSettings
) – Settings for the filter operation - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - maskVolume (
maxon.frameworks.volume.VolumeRef
) – An optional volume object to be used as mask. - maskField (
maxon.frameworks.volume.FieldSampleData
) – An optional field data struct to be used as field mask.
Returns: A new filtered version of the input volume.
Return type: - volume (
-
static
VolumeToolsInterface.
ApplySDFFilterToVolume
(volume, filterType, thread, maskVolume=None, maskField=None)¶ Applies a filter operation to a SDF volume.
Warning
This work only on SDF volumes.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The volume that should be filtered. - filterType (
maxon.frameworks.volume.SDFFilterSettings
) – Settings for the filter operation - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - maskVolume (
maxon.frameworks.volume.VolumeRef
) – An optional volume object to be used as mask. - maskField (
maxon.frameworks.volume.FieldSampleData
) – An optional field data struct to be used as field mask.
Returns: A new filtered version of the input volume.
Return type: - volume (
-
static
VolumeToolsInterface.
BoolVolumes
(voumeOne, volumeTwo, type)¶ Bools two SDF volumes into one with a given bool type of
maxon.BOOLTYPE
.Note
This methods only works for SDF volume, for FOG volume, use
maxon.frameworks.volume.VolumeToolsInterface.MixVolumes()
Parameters: - voumeOne (
maxon.frameworks.volume.VolumeRef
) – The first SDF volume for the boolean operation. - volumeTwo (
maxon.frameworks.volume.VolumeRef
) – The second SDF volume for the boolean operation. - type (
maxon.BOOLTYPE
.) – The bool type.
Returns: The booled volume.
Return type: - voumeOne (
-
static
VolumeToolsInterface.
ConvertFogToSDF
(volume, iso, thread)¶ Convert a fog Volume to a SDF volume.
Note
The resulting surface of the SDF volume is defined by the passed iso value.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The fog volume that should be converted. - iso (float) – The iso value at which the surface should be created.
- thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: A SDF volume.
Return type: - volume (
-
static
VolumeToolsInterface.
ConvertSDFToFog
(volume, cutoff)¶ Convert a SDF Volume to a fog volume.
Note
The interior of the SDF object will be filled with data ranging from 0.0 to 1.0 with a falloff.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The SDF volume that should be converted. - cutoff (float) – The distance for the falloff from 0.0 (SDF 0.0 value) to 1.0.
Returns: A fog volume.
Return type: - volume (
-
static
VolumeToolsInterface.
ConvertVectorToFog
(volume, thread)¶ Convert a vector volume to a fog volume.
New in version R21.
Note
The resulting volume will have the length of the vectors stored at the original voxel position.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The fog volume that should be converted. - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: A fog volume.
Return type: - volume (
-
static
VolumeToolsInterface.
CreateCurlVolume
(volume, thread)¶ Creates a vector volume representing the curl of a vector volume.
New in version R21.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The vector volume the curl should be calculated from. - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: The newly created curl volume.
Return type: - volume (
-
static
VolumeToolsInterface.
CreateGradientVolume
(volume, thread)¶ Creates a gradient volume from a numeric volume.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The numeric volume. - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: The newly created gradient volume.
Return type: - volume (
-
static
VolumeToolsInterface.
CreateMeanCurvatureVolume
(*args)¶ NormalizeVectorVolume(volume, thread) Creates a curvature volume from a numeric volume.
New in version R21.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The numeric volume. - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: The newly created curvature volume.
Return type: - volume (
-
static
VolumeToolsInterface.
CreateNewFloat32Volume
(background)¶ Creates a new float volume with default transform.
Note
The gridtype will be
c4d.GRIDCLASS_UNKNOWN
.Parameters: background (float) – The background value for the volume. Returns: The newly created volume. Return type: maxon.frameworks.volume.VolumeRef
-
static
VolumeToolsInterface.
CreateNewVector32Volume
(background)¶ Creates a new float vector volume with default transform.
New in version R21.
Note
The gridtype will be
c4d.GRIDCLASS_UNKNOWN
.Parameters: background ( maxon.Vector32
) – The background vector value for the volume.Returns: The newly created volume. Return type: maxon.frameworks.volume.VolumeRef
-
classmethod
VolumeToolsInterface.
CreatePlatonicVolume
(sides, size, position, gridSize, bandWidth, thread, creationTransform=None)¶ Creates a SDF volume of a platonic shape.
Note
If invalid Arguments are set the function returns an empty volume.
Parameters: - sides (int) –
The number of sides of the platonic.
Define the valid Arguments in the description of the parameter
- size (float) – The size of the created platonic.
- position (Union[
maxon.Vector
,c4d.Vector
]) – The position of the platonic. - gridSize (float) – The desired gridsize of the created volume.
- bandWidth (int) –
The amount of interior and exterior voxels that distance information is calculated for.
Should be greater than 1.
- thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - creationTransform (
maxon.Matrix
) – An optional override to the target grid matrix.
Returns: The created SDF volume representing the input platonic settings.
Return type: - sides (int) –
-
static
VolumeToolsInterface.
CreateSphereVolume
(radius, position, gridSize, bandWidth, thread, creationTransform=None)¶ Creates a SDF volume of a spherical shape.
Parameters: - radius – The radius of the created sphere.
- radius – float
- position – The position of the sphere.
- position – Union[
maxon.Vector
,c4d.Vector
] - gridSize – The desired gridsize of the created volume.
- gridSize – float
- bandWidth –
The amount of interior and exterior voxels that distance information is calculated for.
Should be greater than 1.
- bandWidth – int
- thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - creationTransform (
maxon.Matrix
) – An optional override to the target grid matrix.
Returns: The created SDF volume representing the input sphere settings.
Return type:
-
static
VolumeToolsInterface.
GetGridNamesFromFile
(filename)¶ Read and return the gridnames from a .vdb file.
Parameters: filename ( maxon.Url
) – The url of the file.Returns: A data dictionary with metadata stored under string keys. Return type: maxon.DataDictionary
-
static
VolumeToolsInterface.
GetMetaDataFromFile
(filename)¶ Read and return the metadata from a .vdb file.
Parameters: filename ( maxon.Url
) – The url of the file.Returns: A data dictionary with metadata stored under string keys. Return type: maxon.DataDictionary
-
static
VolumeToolsInterface.
LoadAllGridsIntoVolumes
(filename, scale, volume, metaData)¶ Loads all grids into a list of volumes from a .vdb file.
Parameters: - filename (
maxon.Url
) – The url of the file to load from. - scale (float) – A scale factor for loading the grids.
- volume (
maxon.BaseArray
(maxon.frameworks.volume.VolumeRef
)) – The output list of loaded volumes. - metaData (
maxon.DataDictionary
) – If passed, will be filled with the metadata from the file.
- filename (
-
static
VolumeToolsInterface.
LoadGridIntoVolume
(filename, scale, gridIndex, volume, metaData)¶ Loads a grid into a volume from a .vdb file.
Parameters: - filename (
maxon.Url
) – The url of the file to load from. - scale (float) – A scale factor for loading the grids.
- gridIndex (int) – The index of the grid in the .vdb file.
- volume (
maxon.frameworks.volume.VolumeRef
) – The volume reference to load the grid into. - metaData (
maxon.DataDictionary
) – If passed, will be filled with the metadata from the file.
- filename (
-
static
VolumeToolsInterface.
LoadVDBFile
(filename, scale, gridNames, gridIndices, metaData)¶ Loads volumes from a .vdb file.
Parameters: - filename (
maxon.Url
) – The url of the file to load from. - scale (float) – A scale factor for loading the grids.
- gridNames (
maxon.BaseArray
(maxon.String
)) – If amaxon.BaseArray
is passed, it will be filled with the grid names. - gridIndices (
maxon.BaseArray
(maxon.Int
)) – Optional list of indices that should be loaded from the file. - metaData (
maxon.DataDictionary
) – If passed, will be filled with the metadata from the file.
Returns: A list of volumes that were loaded from the .vdb file.
Return type: - filename (
-
classmethod
VolumeToolsInterface.
MeshToVolume
(vertices, polygons, polygonObjectMatrix, gridSize, bandWidthInterior, bandWidthExterior, thread, conversionSettings=maxon.POLYGONCONVERSIONFLAGS.NONE, creationTransform=None)¶ Converts a polygon object to a SDF volume.
Parameters: - vertices (
maxon.BaseArray
(maxon.Vecor
)) – The vertex positions of the polygon object. - polygons (
maxon.BaseArray
(maxon.frameworks.volume.VolumeConversionPolygon
)) – The polygon information. - polygonObjectMatrix (
maxon.Matrix
) – The global position, scale and rotation matrix of the polygon object. - gridSize (float) – The desired gridsize of the created volume.
- bandWidthInterior (int) – The amount of exterior voxels that distance information is calculated for.
- bandWidthExterior (int) – The amount of interior voxels that distance information is calculated for.
- thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - conversionSettings (
maxon.POLYGONCONVERSIONFLAGS
) – Optional settings for the conversion to Volume - creationTransform –
An optional override to the target grid matrix.
If this is used the gridSize is ignored.
- creationTransform –
maxon.Matrix
Returns: The converted SDF volume representing the input polygon object.
Return type: - vertices (
-
static
VolumeToolsInterface.
MixVectorVolumes
(volumeOne, volumeTwo, type)¶ Mix two volumes into one with a given mix type of
maxon.MIXVECTORTYPE
.New in version R21.
Parameters: - volumeOne (
maxon.frameworks.volume.VolumeRef
) – The first vector volume for the mix operation. - volumeTwo (
maxon.frameworks.volume.VolumeRef
) – The second vector volume for the mix operation. - type (
maxon.MIXVECTORTYPE
.) – The mix type.
Returns: The mixed vector volume.
Return type: - volumeOne (
-
static
VolumeToolsInterface.
MixVolumes
(volumeOne, volumeTwo, type)¶ Mix two volumes into one with a given mix type of
maxon.MIXTYPE
.Parameters: - volumeOne (
maxon.frameworks.volume.VolumeRef
) – The first volume for the mix operation. - volumeTwo (
maxon.frameworks.volume.VolumeRef
) – The second volume for the mix operation. - type (
maxon.MIXTYPE
.) – The mix type.
Returns: The mixed volume.
Return type: - volumeOne (
-
static
VolumeToolsInterface.
NormalizeVectorVolume
(volume, thread)¶ Creates a normalized vector volume from an input vector volume.
New in version R21.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The vector volume that should be normalized. - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: The newly created normalized vector volume.
Return type: - volume (
-
static
VolumeToolsInterface.
PointsToVolume
(pointObjects, gridSize, bandWidth, thread, creationTransform=None, velocityScale=0.0)¶ - 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.
Parameters: - pointObjects – A list of Delegate/Object pairs that specify how to get point positions from the object.
- gridSize (float) – The desired gridsize of the created volume.
- bandWidth (int) – The amount of voxels around the creates spheres that distance information is calculated for.
- thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - creationTransform (
maxon.Matrix
) –An optional override to the target grid matrix.
If this is used the gridSize is ignored.
- velocityScale (float) – A velocity scale that the volumes will be extended to if they have a direction set.
Returns: The converted SDF volume representing the input polygon object.
Return type:
-
static
VolumeToolsInterface.
ResampleVolume
(volume, resampleTransform, interpolationType, thread)¶ Resample a volume into a new transformation matrix.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The volume that should be resampled. - resampleTransform (
maxon.Matrix
) – The transformation matrix in which the volume should be resampled into. - interpolationType (
maxon.RESAMPLEINTERPOLATIONTYPE
) – The resample interpolation type. - thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against.
Returns: The created resampled volume.
Return type: - volume (
-
static
VolumeToolsInterface.
RotateVectorVolume
(volume, rotationAxis, angle, thread, maskField=None)¶ Rotate the vectors of a vector volume by a specified angle around a rotation axis.
New in version R21.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The vector volume to rotate. - rotationAxis (
maxon.Vector
) – The rotation axis to rotate around. - angle (float) – The angle in radians to rotate.
- thread (
maxon.ThreadRef
) – A thread reference that cancellation is tested against. - maskField (
maxon.frameworks.volume.FieldSampleData
) – An optional field data struct to be used as field mask.
Returns: The newly created curvature volume.
Return type: - volume (
-
static
VolumeToolsInterface.
SaveVDBFile
(filename, scale, volumes, metaData)¶ Saves volumes to a .vdb file.
Parameters: - filename (
maxon.Url
) – The url of the file to save to. - scale (float) – A scale factor for saving the grids.
- volumes (
maxon.BaseArray
(maxon.frameworks.volume.VolumeRef
)) – A list of volumes that should be saved to the .vdb file. - metaData (
maxon.DataDictionary
) –Optional Metadata to write to the file.
Have to be added under string keys to the data dictionary.
- filename (
-
static
VolumeToolsInterface.
VolumeToMesh
(volume, iso, adaptiveValue)¶ Extracts a polygon object iso surface from a volume. This is done by a marching cube algorithm.
Parameters: - volume (
maxon.frameworks.volume.VolumeRef
) – The volume to extract a surface from. - iso (float) – The iso value at which a surface should be extracted.
- adaptiveValue (float) – An adaptive value between 0.0 and 1.0 that reduces the polygon count based on curvature.
Returns: The extracted polygon object.
Return type: - volume (