If you ask a COP for its geometry via the hou.CopNode.vdb, you’ll cook the COP and get a read-only hou.NanoVDB. Unlike with SOPs and Geometry objects, the result is no longer tied to the COP Node so it stays the same if the COP node recooks or is deleted.
Call hou.NanoVDB.freeze to edit an NanoVDB. This returns another NanoVDB object that’s an independent writeable copy. Writing to the frozen vdb doesn’t affect the earlier read-only versions.
Methods ¶
close()
Resets this object to be an empty object. This stops it holding a reference to the underlying NanoVDB data. This will also happen when the object goes out of scope and is garbage collected, but the close() provides exact control over the timing.
NanoVDBs also support contexts so the with statement can be used to auto-close the nanovdb at the with-block end.
vdbType()
→ hou.EnumValue
Returns the vdb’s vdb type, which consists of its precision, float vs integer, and vector size.
typeInfo()
→ hou.EnumValue
Returns the semantic type of the vdb. This is used for things like automatic visualizations.
setTypeInfo(storagetype)
Changes the semantic type of the vdb.
Requires a writable vdb.
channelCount()
→ int
Returns the number of channels in the vdb.
leafCount()
→ int64
Returns the number of active leaf nodes in the VDB. If the leaf nodes are fully active, the active voxels will be 512 times this.
resolution()
→ hou.Vector3
Return the x, y, and z dimensions of the active leaves. Since VDB volumes are sparse, this represents the virtual resolution of all the voxels which have data (or are “active”).
onCPU()
→ bool
A NanoVDB may be stored on the CPU or GPU. This is true if it is stored on the CPU.
onGPU()
→ bool
A NanoVDB may be stored on the CPU or GPU. This is true if it is stored on the GPU.
voxelSize()
→ hou.Vector3
The world space size of voxels in the VDB.
indexToWorldTransform()
→ hou.Matrix4
A transform from the voxel indices into worlds space. Note this does not account for tapers.
worldToIndexTransform()
→ hou.Matrix4
A transform from the world space into the voxel indices. Note this does not account for tapers.
freeze()
→ hou.NanoVDB
Create a writable copy of this and return it.
Note
The actual buffer duplication won’t be done until a write is performed.
isFrozen()
→ bool
Returns if this is frozen, and hence writable.
attributes()
→ dict
This method is deprecated in favor of hou.NanoVDB.properties. Returns the vdb properties present on this vdb.
setAttributes(p: dict)
This method is deprecated in favor of hou.NanoVDB.setProperties. Replaces the vdb properties with the provided dictionary.
updateAttributes(p: dict)
This method is deprecated in favor of hou.NanoVDB.updateProperties. Updates the vdb properties with the provided dictionary, replacing any matching keys.
properties()
→ std::map<std::string,hboost::any>
Returns the vdb properties present on this vdb.
setProperties(std::map<std::string, p)
Replaces the vdb properties with the provided dictionary.
updateProperties(std::map<std::string, p)
Updates the vdb properties with the provided dictionary, replacing any matching keys.
rawNanoVDB()
→ hou.BinaryString
Return all the voxels as a binary string. This is in the NanoVDB memory layout, so can be re-interpreted into third party tools that understand NanoVDB.
Note NanoVDB is not meant as a long term storage format, so it is recommended any long term storage is done with VDBs rather than relying on this format being the same.
setFromRawNanoVDB(values, length)
Take a binary string in values and replaces this NanoVDB with
the NanoVDB so encoded.
computeMin(channel=0)
→ int
or float
Returns the vdb’s minimum value across all voxels of the selected channel.
computeMax(channel=0)
→ int
or float
Returns the vdb’s maximum value across all voxels of the selected channel.
computeAverage(channel=0)
→ float
Returns the vdb’s average value across all voxels of the selected channel.
computeMinLength()
→ float
Returns the vdb’s minimum Euclidean length value across all the voxels.
computeMaxLength()
→ float
Returns the vdb’s maximum Euclidean length value across all the voxels.