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 layer 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 layer.
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.
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()
→ std::map<std::string,hboost::any>
Returns the vdb attributes present on this layer.
setAttributes(std::map<std::string, p)
Replaces the vdb attributes with the provided dictionary.
updateAttributes(std::map<std::string, p)
Updates the layer attributes 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.