VDB_TOOL(1)
Hiii bestie!! ๐ Welcome to vdb_tool(1) โ the User Commands manual page for the most iconic command-line tool in all of openvdb. No cap. This tool is literally a whole vibe: you give it a sequence of tasks, and it slays. Let's get into it. โจ
NAME ๐
vdb_tool โ perform a use-defined sequence of tasks ๐
SYNOPSIS ๐ฆ
Okay so, this command-line tool, dubbed vdb_tool, can combine any number of the high-level tools available in openvdb/tools. For instance, it can convert a sequence of polygon meshes and particles to level sets, and perform a large number of operations on these level set surfaces. It can also generate adaptive polygon meshes from level sets, ray-trace images and export particles, meshes or VDBs to disk or even stream VDBs to STDOUT so other tools can render them (using pipelining). We denote the operations actions, and their arguments options. Any sequence of actions and their options can be exported and imported to configuration files, which allows convenient reuse. This command-line tool also supports a string-evaluation language that can be used to define procedural expressions for options of the actions. Currently the following list of actions are supported:
for/endโ Defines the scope of a for-loop with a range for a loop-variableeach/endโ Defines the scope of an each-loop with a list for a loop-variableif/endโ If-statement used to enable/disable actionsevalโ Evaluate an expression written in our Reverse Polish Notation (see below)configโ Load a configuration file and add the actions for processingdefaultโ Set default values used by all subsequent actionsreadโ Read mesh, points and level sets as obj, ply, abc, stl, pts, vdb or nvdb fileswriteโ Write a polygon mesh, points or level set as a obj, ply, stl, abc or vdb filevdb2pointsโ Extracts points from a VDB gridmesh2lsโ Convert a polygon mesh to a narrow-band level setpoints2lsโ Convert points into a narrow-band level setpoints2vdbโ Converts points into a VDB PointDataGridiso2lsโ Convert an iso-surface of a scalar field into a level setls2fogโ Convert a level set into a fog volumesegmentโ Segment level set and float grids into its disconnected partssphereโ Create a narrow-band level set of a sphereplatonicโ Create a narrow-band level set of a tetrahedron(4), cube(6), octahedron(8), dodecahedron(12) or icosahedron(2)dilateโ Dilate a level set surfaceerodeโ Erode a level set surfaceopenโ Morphological opening of a level set surfacecloseโ Morphological closing of a level set surfacegaussโ Gaussian convolution of a level set surface, i.e. surface smoothingmeanโ Mean-value filtering of a level set surfacemedianโ Median-value filtering of a level set surfaceunionโ Union of two narrow-band level setsintersectionโ Intersection of two narrow-band level setsdifferenceโ Difference of two narrow-band level setspruneโ Prune the VDB tree of a narrow-band level setfloodโ Signed flood-fill of a narrow-band level setcptโ Closest point transform of a narrow-band level setgradโ Gradient vector of a scalar VDBcurlโ Curl of a vector VDBdivโ Compute the divergence of a vector VDBcurvatureโ Mean curvature of a scalar VDBlengthโ Compute the magnitude of a vector VDBminโ Composite two grid by means of minmaxโ Composite two grid by means of maxsumโ Composite two grid by means of summultiresโ Compute multi-resolution gridsenrightโ Advects a level set in a periodic and divergence-free velocity field. Primarily intended for benchmarksexpandโ Expand the narrow band of a level setresampleโ Re-sample a scalar VDB gridtransformโ Apply affine transformations to VDB gridsls2meshโ Convert a level set surface into an adaptive polygon mesh surfaceclipโ Clips one VDB grid with another VDB grid or a bbox or frustumrenderโ Render and save an image of a level set or fog VDBclearโ Deletes cached VDB grids and geometry from memoryprintโ Print information about the cached geometries and VDBs
DESCRIPTION ๐ธ
This command-line tool can perform a use-defined, and possibly non-linear, sequence of high-level tasks available in openvdb. For instance, it can convert polygon meshes and particles to level sets, and subsequently perform a large number of operations on these level set surfaces. It can also generate adaptive polygon meshes from level sets, write them to disk and even render them to image files.
Version: 10.6.1
Surface points:
vdb_tool -read points.[obj/ply/stl/pts] -points2ls d=256 r=2.0 w=3 -dilate r=2 -gauss i=1 w=1 -erode r=2 -ls2m a=0.25 -write output.[ply/obj/stl]
Convert mesh:
vdb_tool -read mesh.[ply/obj] -mesh2ls d=256 -write output.vdb config.txt
Config example:
vdb_tool -config config.txt
-clear ๐งน
Deletes geometry, VDB grids and local variables.
geo*|0,1,...โ List of geometries to delete (defaults to all)vdb*|0,1,...โ List of VDB grids to delete (defaults to all)variables1|0|true|falseโ Clear all the local variables (defaults to off)
-clip โ๏ธ
Clip a VDB grid against another grid, a bbox or frustum.
vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processingbbox(0,0,0),(1,1,1)โ Min and max of the world-space bounding-box used for clipping. Defaults to empty, i.e. disabledtaper1โ Taper of the frustum (requiresbboxanddepthto be specified). Defaults to-1, i.e. disableddepth1โ Depth in world units of the frustum (requiresbboxandtaperto be specified). Defaults to-1, i.e. disabledmask1โ Age (i.e. stack index) of a mask VDB used for clipping. Defaults to-1, i.e. disabled
-close ๐ซ
Morphological closing, i.e. dilation followed by erosion, of level set surface by a fixed radius.
radius1.0โ Radius in voxel units by which the surface is closedspace1|2|3|5โ Order of the spatial discretization (defaults to5, i.e. WENO)time1|2|3โ Order of the temporal discretization (defaults to1, i.e. explicit Euler)vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.
-config, -c โ๏ธ
Import and process one or more configuration files.
filesconfig1.txt,config2.txt...โ List of configuration files to load and executeexecute1|0|true|falseโ Toggle wether to execute the actions in the config fileupdate1|0|true|falseโ Toggle wether to update the version number of the config file
-cpt ๐ฏ
Generate a vector grid with the closest-point-transform to a level set surface.
vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processing
-curl ๐
Generate a vector grid with the curl of another vector grid.
vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processing
-curvature ๐ง
Generate scalar grid with the mean curvature of a level set surface.
vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processing
-debug ๐
Print debugging information to the terminal.
-default ๐
Define default values to be used by subsequent actions.
dim256โ Default grid resolution along the longest axisvoxel0.01โ Default voxel size in world units. A value of zero indicates thatdimis used to derive the voxel size.width3.0โ Default narrow-band width of level sets in voxel unitstime1|2|3โ Default temporal discretization orderspace1|2|3|5โ Default spatial discretization orderkeep1|0|true|falseโ By default delete the input
-difference โ
CSG difference of two level sets surfaces.
vdb0,1โ Ages (i.e. stack indices) of the two VDB grids to difference. Defaults to0,1, i.e. two most recently inserted VDBs.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processingprunetrueโ Toggle wether to prune the tree after the boolean operation (enabled by default)rebuildtrueโ Toggle wether to re-build the level set after the boolean operation (enabled by default)
-dilate ๐
Erode level set surface by a fixed radius.
radius1.0โ Radius in voxel units by which the surface is dilatedspace1|2|3|5โ Order of the spatial discretization (defaults to5, i.e. WENO)time1|2|3โ Order of the temporal discretization (defaults to1, i.e. explicit Euler)vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.
-div โ
Generate a scalar grid with the divergence of a vector grid.
vdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processing
-each ๐
Start of each-loop over a user-defined loop variable and list of values.
ssphere,bunny,...โ Defined name of loop variable and list of its values.
-end ๐
Marks the end scope of -for, -each, and -if control actions.
-enright ๐
Performs Enright advection benchmark test on a level set.
translate(0.0,0.0,0.0)โ Defines the origin of the Enright velocity fieldscale1.0โ Defined the scale of the Enright velocity fielddt0.05โ Time-step the input level set is advectedvdb0โ Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ Toggle wether the input VDB is preserved or deleted after the processing
-erode ๐ชฆ
Erode level set surface by a fixed radius.
radius1.0โ Radius in voxel units by which the surface is erodedspace1|2|3|5โ Order of the spatial discretization (defaults to5, i.e. WENO)
time1|2|3โ the order of the temporal discretization ๐ฐ๏ธ defaults to1, which is the explicit Euler vibe.vdb0โ the age (aka the stack index ๐ฅ) of the VDB grid you want processed. Defaults to0, i.e. the most recently inserted VDB, the freshest one, the main character ๐.
-evalโ evaluate a string expression โจstr{1:2:+}โ one or more strings for the stack-oriented programming language to chew on ๐ง . Any non-empty string output gets printed straight to your terminal.
help*|+,-,...โ print a list of all the list operations, or just the ones you name, each with a little brief documentation attached ๐-examplesโ prints examples to the terminal and then terminates, bye bestie ๐-expandโ expand the narrow band of a level set ๐dilate1โ how many integer voxels the narrow band of the input SDF gets dilated.iter1โ number of iterations of the fast sweeping algorithm (every single one uses 8 sweeps ๐).vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing ๐๏ธ
-floodโ signed-flood filling of a level set VDB ๐vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.
-forโ start of a for-loop over a user-defined loop variable and range ๐i0,9|i=0,9,2โ define the name of the loop variable and its range.
-gaussโ Gaussian convolution of a level set surface ๐ซง soft blur energyiter1โ how many iterations the filter gets applied.space1|2|3|5โ order of the spatial discretization (defaults to5, i.e. WENO).time1|2|3โ order of the temporal discretization (defaults to1, i.e. explicit Euler).vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.size1โ size of the filter, in voxel units.
-gradโ generate a vector grid holding the gradient of a scalar grid ๐vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing.
-help,-hโ print documentation for one, multiple or all available actions ๐actionsread,write,...โ the list of actions you want documented. If the list is empty, documentation is printed for all available actions, and if other actions come before this one, documentation is printed for those actions only.exit1|0|true|falseโ toggles whether to terminate after this action or not ๐ชbrief1|0|true|falseโ toggles between brief or detailed documentation.
-ifโ start of an if-scope ๐ง If the value of its option, namedtest, evaluates to false, the entire scope is skipped, periodt.test0|1|false|trueโ the boolean value used to test the if-statement.
-intersectionโ CSG intersection of two level sets surfaces โ๏ธ two shapes walk in, their overlap walks outvdb0,1โ ages (i.e. stack indices) of the two VDB grids to intersect. Defaults to0,1, i.e. the two most recently inserted VDBs.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing.prunetrueโ toggles whether to prune the tree after the boolean operation (enabled by default) ๐ณrebuildtrueโ toggles whether to re-build the level set after the boolean operation (enabled by default).
-iso2ls,-i2lโ convert an iso-surface of a scalar field into a level set (i.e. an SDF) ๐ฆvdb0,1โ age (i.e. stack index) of the VDB grid to be processed, plus an optional reference grid. Defaults to0, i.e. most recently inserted VDB.iso0.0โ value of the iso-surface to compute the level set from.voxel0.0โ voxel size in world units (defaults to zero, i.e. the transform of the output matches the input).width3.0โ half-width, in voxel units, of the output narrow-band level set (defaults to 3 units on either side of the zero-crossing).keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing.nameiso2ls_inputโ specify the name of the resulting VDB (by default it's derived from the input VDB).
-lengthโ generate a scalar grid holding the magnitude of a vector grid ๐vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing.
-ls2fog,-l2fโ convert a level set VDB into a VDB with a fog volume, i.e. normalized density ๐ซ๏ธvdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing.namels2fog_inputโ specify the name of the resulting VDB (by default it's derived from the input VDB).
-ls2mesh,-l2mโ convert a level set to an adaptive polygon mesh ๐บadapt0.9โ normalized metric for the adaptive meshing.0is a uniform mesh and1is a fully adaptive mesh. The page says it defaults to0๐ (we're just the messenger, no cap).iso0.1โ iso-value used to define the implicit surface. Defaults to zero.vdb0โ age (i.e. stack index) of the level set VDB grid to be meshed. Defaults to0, i.e. most recently inserted VDB.mask1โ age (i.e. stack index) of the level set VDB grid used as a surface mask during meshing. Defaults to-1, i.e. it's disabled.invert1|0|true|falseโ boolean toggle to mesh the complement of the mask ๐ญ Defaults to false and is ignored if no mask is specified.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing. The mask is never removed! ๐namels2mesh_inputโ specify the name of the resulting vdb (by default it's derived from the input VDB).
-maxโ given grids A and B, computemax(a, b)per voxel โฌ๏ธvdb0,1โ ages (i.e. stack indices) of the two VDB grids to composit. Defaults to0,1, i.e. the two most recently inserted VDBs.keep1|0|true|falseโ toggles whether the input VDBs are preserved or deleted after the processing.
-meanโ mean value filtering of a level set surface ๐งดiter1โ how many iterations the filter gets applied.space1|2|3|5โ order of the spatial discretization (defaults to5, i.e. WENO).time1|2|3โ order of the temporal discretization (defaults to1, i.e. explicit Euler).vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.size1โ size of the filter, in voxel units.
-medianโ median value filtering of a level set surface ๐พiter1โ how many iterations the filter gets applied.space1|2|3|5โ order of the spatial discretization (defaults to5, i.e. WENO).time1|2|3โ order of the temporal discretization (defaults to1, i.e. explicit Euler).vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.size1โ size of the filter, in voxel units.
-mesh2ls,-m2lsโ convert a polygon mesh into a narrow-band level set, i.e. a narrow-band signed distance to a polygon mesh ๐งdim256โ largest dimension in voxel units of the mesh bbox (defaults to256). Ifvdborvoxelis defined, thendimis ignored.voxel0.01โ voxel size in world units (by defaultdimis used to derivevoxel). If you specify it, this option takes precedence overdim๐.width3.0โ half-width, in voxel units, of the output narrow-band level set (defaults to 3 units on either side of the zero-crossing).geo0โ age (i.e. stack index) of the geometry to be processed. Defaults to0, i.e. most recently inserted geometry.vdb0โ age (i.e. stack index) of the reference grid used to define the transform. Defaults to-1, i.e. disabled. If specified, this option takes precedence overdimandvoxel! ๐ฅkeep1|0|true|falseโ toggles whether the input geometry is preserved or deleted after the conversion.namemesh2ls_inputโ specify the name of the resulting vdb (by default it's derived from the input geometry).
-minโ given grids A and B, computemin(a, b)per voxel โฌ๏ธvdb0,1โ ages (i.e. stack indices) of the two VDB grids to composit. Defaults to0,1, i.e. the two most recently inserted VDBs.keep1|0|true|falseโ toggles whether the input VDBs are preserved or deleted after the processing.
-multiresโ construct a LoD sequence of VDB trees with powers-of-two refinements ๐ชlevels2โ number of multi-resolution grids in the output LoD sequence.vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keep1|0|true|falseโ toggles whether the input VDB is preserved or deleted after the processing.
-openโ morphological opening, i.e. erosion followed by dilation, of a level set surface by a fixed radius ๐ชโจradius1.0โ radius in voxel units by which the surface is opened.space1|2|3|5โ order of the spatial discretization (defaults to5, i.e. WENO).time1|2|3โ order of the temporal discretization (defaults to1, i.e. explicit Euler).vdb0โ age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.
-platonicโ create a level set shape with the specified number of polygon faces ๐ฒ solids are literally the momentdim256โ largest dimension in voxel units of the bbox of all the shape (defaults to256). Ifvoxelis defined,dimis ignored.voxel0.01โ voxel size in world units (by defaultdimis used to derivevoxel). If specified, this option takes precedence overdim.faces{4|6|8|12|20}โ number of polygon faces of the shape to generate the level set VDB from.scale1.0โ scale of the shape in world units. E.g. iffaces=6andscale=1.0the result is a unit cube ๐งcenter(0.0,0.0,0.0)โ center of the shape in world units. Defaults to the origin.width3.0โ half-width, in voxel units, of the output narrow-band level set (defaults to 3 units on either side of the zero-crossing).nameTetrahedronโ specify the name of the resulting VDB (by default it's derived from the face count).
-points2ls,-p2lโ convert geometry points into a narrow-band level set ๐ซงdim256โ largest dimension in voxel units of the bbox of all the points (defaults to256). Ifvoxelis defined,dimis ignored.voxel0.01โ voxel size in world units (by defaultdimis used to derivevoxel). If specified, this option takes precedence overdim.
โฆaaaaand the rest of that one's knobs, bestie:
widthโ3.0. Half-width, in voxel units, of the output narrow-band level set. Defaults to3units on either side of the zero-crossing. ๐radiusโ2.0. Radius, in voxel units, of the input points.geoโ0. Age (a.k.a. stack index) of the geometry you want processed. Defaults to0, i.e. the most recently inserted geometry. periodt.keepโ1|0|true|false. Toggles whether the input points are preserved or deleted after the processing.nameโpoints2ls_input. Sets the name of the resulting VDB (by default it gets derived from the input points). โจ
-points2vdb,-p2vโ Encode geometry points into a VDB grid. Turning those lil point clouds into grid content, iconic ๐geoโ0. Age (i.e. stack index) of the geometry to be processed. Defaults to0, i.e. most recently inserted geometry.keepโ1|0|true|false. Toggles whether the input points are preserved or deleted after the processing.ppvโ8. The number of points per voxel in the output VDB grid (defaults to8).bitsโ16|8|32. The number of bits used to represent a single point in the VDB grid (defaults to16, i.e. half precision).nameโpoints_2vdb_input. The name of the resulting VDB (by default it's derived from the input geometry).
-print,-pโ Prints information to the terminal about the current stack of VDB grids and geometry. A little peek behind the curtain ๐vdbโ*. Print information about VDB grids.geoโ*. Print information about geometries.memโ0|1|false|true. Print a list of all stored variables.
-pruneโ Prune away inactive values in a VDB grid. Marie Kondo-ing your tree, no cap ๐งนvdbโ0. Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.
-quietโ Disable printing to the terminal. Shhh. silence is golden and so are you ๐คซ-read,-iโ Read one or more geometry or VDB files from disk orSTDIN. Incoming!!! ๐ฌfilesโ{file|stdin}.{abc|obj|ply|stl|vdb}. List of files or the input stream, e.g.file.vdb,stdin.vdb. Note that"files="is optional since any argument without"="is interpreted as a file and appended to"files".gridsโ*|grid_name,.... List of VDB grids names to be imported (defaults to"*", i.e. import all available grids).delayedโ1|0|true|false. Toggle delayed loading of VDB grids (enabled by default). This option is ignored by other file types.
-renderโ Ray-tracing of level set surfaces and volume rendering of fog volumes. Camera. Lights. Cinema. main character energy fr fr ๐ฌfilesโoutput.{jpg|png|ppm|exr}. File used to save the rendered image to disk.vdbโ0. Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keepโ1|0|true|false. Toggles whether the input VDB is preserved or deleted after the rendering.cameraโpersp|ortho. Perspective or orthographic camera.apertureโ41.2136. Width in mm of the frame of a perspective camera, i.e. the visible field (defaults to41.2136mm).focalโ50. Focal length of a perspective camera in mm (defaults to50mm).isovalueโ0.0. Iso-value used during ray-intersection of level set surfaces.samplesโ1. Number of samples (rays) per pixel.imageโ1920x1080. Image size defined in terms of pixel resolution.translateโ(0,0,0). Translation of the camera in world-space units, applied after rotation.rotateโ(0,0,0). Rotation in degrees of the camera in world space (applied in x, y, z order).targetโ Target point in world space that the camera will point at (if undefined, target is set to the center of the bbox of the grid).upโ(0,1,0). Vector that should point up after rotation with lookat.lookatโtrue. Rotate the camera so it looks at the center of the shape, usingupas the horizontal direction.nearโ0.001. Depth of the near clipping plane in world-space units.farโ3.4e+38. Depth of the far clipping plane in world-space units.shaderโdiffuse|normal|position|matte. Shader type; either"diffuse","matte","normal"or"position".lightโ(0.3,0.3,0.0),(0.7,0.7,0.7). Light source direction and optional color.frameโ1.0. Orthographic camera frame width in world units.cutoffโ0.005. Density and transmittance cutoff value (ignored for level sets).gainโ0.2. Amount of scatter along the shadow ray (ignored for level sets).absorbโ(0.1,0.1,0.1). Absorption coefficients for RGB (ignored for level sets).scatterโ(1.5,1.5,1.5). Scattering coefficients for RGB (ignored for level sets).stepโ1.0,3.0. Step size in voxels for integration along the primary ray (ignored for level sets).colorgridโ1. Age of avec3sVDB grid to be used to set material colors. Defaults to-1, i.e. disabled.
-resampleโ Resample one VDB grid into another VDB grid, or a transformation of the input grid. glow-up via math ๐ฆvdbโ0,1. Pair of input and optional output grids (i.e. stack index) to be processed. Defaults to0,1, i.e. most recent VDB is resampled to match the transform of the second-most recent VDB.scaleโ0. Scale used to transform the input grid (ignored if two grids are specified withvdb).translateโ(0,0,0). Translation used to transform the input grid (ignored if two grids are specified withvdb).orderโ1. Order of the polynomial interpolation kernel used during resampling.keepโ1|0|true|false. Toggles whether the input VDB is preserved or deleted after the processing.
-scatterโ Scatter points into the active values of an input VDB grid. Confetti but make it voxels ๐countโ0. Fixed number of points to randomly scatter (disabled by default).densityโ0.0. Uniform density of points per active voxel (disabled by default).ppvโ8. Number of points per active voxel (defaults to8).vdbโ0. Age (i.e. stack index) of the VDB grid to scatter points into. Defaults to0, i.e. most recently inserted VDB.keepโ1|0|true|false. Toggles whether the input VDB is preserved or deleted after the processing.nameโscatter_input. The name of the resulting points (by default it's derived from the input VDB).
-segmentโ Segment an input VDB into a list of topologically disconnected VDB grids. Splitting the friend group ๐vdbโ0. Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keepโ1|0|true|false. Toggles whether the input VDB is preserved or deleted after the processing.
-sphereโ Create a level set sphere, i.e. a narrow-band signed distance to a sphere. The perfect lil ball ๐ฎdimโ256. Largest dimension in voxel units of the sphere (defaults to256). If"voxel"is defined,"dim"is ignored.voxelโ0.0. Voxel size in world units (by default"dim"is used to derive"voxel"). If specified, this option takes precedence over"dim". Defaults to0.0, i.e. this option is disabled.radiusโ1.0. Radius of sphere in world units.centerโ(0.0,0.0,0.0). Center of sphere in world units.widthโ3.0. Half-width in voxel units of the output narrow-band level set (defaults to3units on either side of the zero-crossing).nameโsphere. Name assigned to the level set sphere.
-sumโ Given grids A and B, computesum(a, b)per voxel. Math girlies rise ๐งฎvdbโ0,1. Ages (i.e. stack indices) of the two VDB grids to composit. Defaults to0,1, i.e. two most recently inserted VDBs.keepโ1|0|true|false. Toggles whether the input VDBs are preserved or deleted after the processing.
-transformโ Apply affine transformations (uniform scale -> rotation -> translation) to a VDB grid and geometry. The order matters, bestie, respect the pipeline ๐rotateโ(0.0,0.0,0.0). Rotation in radians around x, y, z axis.translateโ(0.0,0.0,0.0). Translation in world units along x, y, z axis.scaleโ1.0. Uniform scaling in world units.vdbโ0,2,... Age (i.e. stack index) of the VDB grid to be processed. Defaults to empty.geoโ0,2,... Age (i.e. stack index) of the geometry to be processed. Defaults to empty.keepโ1|0|true|false. Toggles whether the input VDB is preserved or overwritten.
-unionโ CSG union of two level set surfaces. Two shapes become one, we love a merge ๐ซถvdbโ0,1. Ages (i.e. stack indices) of the two VDB grids to union. Defaults to0,1, i.e. two most recently inserted VDBs.keepโ1|0|true|false. Toggles whether the input VDB is preserved or deleted after the processing.pruneโtrue. Toggle whether to prune the tree after the boolean operation (enabled by default).rebuildโtrue. Toggle whether to re-build the level set after the boolean operation (enabled by default).
-vdb2points,-v2pโ Extract points encoded in a VDB to points in a geometry format. Reverse UNO ๐vdbโ0. Age (i.e. stack index) of the VDB grid to be processed. Defaults to0, i.e. most recently inserted VDB.keepโ1|0|true|false. Toggles whether the input VDB is preserved or deleted after the processing.nameโvdb2points_input. The name of the resulting points (by default it's derived from the input VDB).
-verboseโ Print timing information to the terminal. Stats girlie behavior ๐-versionโ Write timing information to the terminal.-write,-oโ Write a list of geometry, VDB or config files to disk orSTDOUT. Save your work, bestie, you will regret it otherwise ๐ญfilesโ{file|stdout}.{obj|ply|stl|vdb|nvdb}. List of files or the output stream, e.g.file.vdborstdin.vdb. Note that"files="is optional since any argument without the"="character is interpreted as a file and appended to"files".geoโ0|1.... Geometry to write (defaults to"0", which is the latest).vdbโ0,1,.... List of VDB grids to write (defaults to"*", i.e. all available grids).keepโ1|0|true|false. Toggles whether to preserve or delete geometry and grids after they have been written.codecโnone|zip|blosc|active. Compression codec for the file or stream.bitsโ32|16|8|4|N. Bit-width of floating point numbers during quantization of VDB and NanoVDB grids, i.e.32is full,16is half (defaults to32). NanoVDB also supports8,4andN, which is adaptive bit-width.ditherโ1|0|true|false. Toggle dithering of quantized NanoVDB grids (disabled by default).absoluteโ1|0|true|false. Toggle absolute or relative error tolerance during quantization of NanoVDBs. Only used ifbits=N. Defaults to absolute.toleranceโ1.0. Absolute or relative error tolerance used during quantization of NanoVDBs. Only used ifbits=N.statsโnone|bbox|extrema|all. Specify the statistics to compute for NanoVDBs.checksumโnone|partial|full. Specify the type of checksum to compute for NanoVDBs.
Also quick thing, bestie โ actions always start with one or more -, and (the one exception being file names) their options always contain a = plus an optional number of leading characters you can type for identification. So -erode r=2 is literally identical to -erode radius=2.0, but -erode rr=2? ๐ nope, that one errors out, because rr doesn't match the first two characters of any option that hangs out with the erode action.
Also fyi this tool keeps two lists of primitives: namely geometry (i.e. points and meshes) and level sets. They can be referenced with geo=n and vdb=n, where the integer n refers to the age (i.e. the stack index) of the primitive โ with n=0 meaning most recent. E.g. -mesh2ls g=1 means convert the second to last geometry (here polygon mesh) to a level set. Likewise -gauss v=0 means perform a gaussian filter on the most recent level set (default).
๐ SUPPORTED FILE FORMATS ๐
Okay so here's the whole roster of file formats this tool speaks, and which direction it speaks them in ๐
vdbโ read and write. OpenVDB sparse volume files withfloat,Vec3fandpoints๐ซถobjโ read and write. ASCII OBJ mesh files withtriangle,quadorpointsplyโ read and write. Binary and ASCII PLY mesh files withtriangle,quadorpointsstlโ read and write. Binary STL mesh files withtrianglesptsโ read only. ASCII PTS points files with one or more point clouds โ๏ธabcโ optional read and write. Alembic binary mesh filesnvdbโ optional read and write. NanoVDB file withvoxelsorpointstxtโ read and write. ASCII configuration file for this toolppmโ write only. Binary PPM image filepngโ optional write only. Binary PNG image filejpgโ optional write only. Binary JPEG image fileexrโ optional write only. Binary OpenEXR image file โจ
Heads up bestie: the ones marked optional are only there if your build was compiled with them, so don't come for me ifabc,nvdb,png,jpgorexrare ghosting you ๐
๐ TERMINOLOGY
Introducing four words we're gonna use constantly, so let's get them straight: actions, options, expressions, and instructions.
- Actions are the high-level openvdb tools, and each one has its own unique set of options. Exhibit A:
-mesh2ls geo=1 voxel=0.1โ here-mesh2lsis the action, andgeoandvoxelare its two options. ๐ - Expressions are strings of code with one or more low-level instructions in our stack-based programming language (more on that below). They start with
{and end with}, and:is the separator between values and instructions. For example,{1:2:+}is an expression holding two values (1and2) and one instruction+, and it reduces down to the string value"3". Go look at the Stack-based string expressions section below for the whole tea โ
Now, the notes, because they matter:
actions always start with one or more -, and (file names being the exception, as always) their associated options always contain a = and an optional number of leading characters used for identification. So -erode r=2 is identical to -erode radius=2.0, but -erode rr=2 will produce an error โ because rr does not match the first two characters of any option associated with the action erode. No cap, that's just how it is. ๐ญ
And this tool maintains two stacks of primitives: geometry (i.e. points and polygon meshes) and VDB volumes (which may contain voxels or points). You reference them with geo=n and vdb=n respectively, where the integer n is the age of the primitive โ meaning its order on the stack. So n=0 is the most recently added primitive, and n=1 is the second primitive added to the internal stack. ๐ง
So -mesh2ls g=1 means convert the second to last geometry (here a polygon mesh) to a level set. And if no other VDB grid exists, that output level set can subsequently be referenced as vdb=0. Which means -gauss v=0 is "perform a gaussian filter on the most recently added level set VDB." By default, the most recent geometry โ i.e. g=0 โ or the most recent level set โ i.e. v=0 โ is the one selected for processing. Convenient, right?? ๐ธ
๐ฆ STACK-BASED STRING EXPRESSIONS
Okay this is the fun part, stay with me. ๐
This tool has its very own light-weight stack-oriented programming language that is (very loosely) inspired by Forth. Specifically, it uses Reverse Polish Notation (RPN) to define instructions that get evaluated while the command-line arguments are being parsed โ options to be precise.
The rules of the vibe:
- All such expressions start with the character
{and end with}. ๐ - Arguments are separated by
:. - Variables starting with
$are substituted by their (previously) defined values. - Variables starting with
@are stored in memory.
So {1:2:+:@x} is conceptually equivalent to x = 1 + 2. Conversely, {:++} is conceptually equivalent to 2 + 1 = 3, since x=2 was already saved to memory. ๐ฅ
This is especially useful in combination with loops, e.g.
-quiet -for i=1,3,1 -eval {:++} -end
will print 2 and 3 to the terminal. Branching is supported too, e.g.
radius={$x:1:>:if(0.5:sin?0.3:cos)}
is conceptually equal to if (x>1) radius=sin(0.5) else radius=cos(0.3). main character energy honestly โญ
Go see the root-searching example below, or just run
vdb_tool -eval help="*"
to get a list of all instructions currently supported by this scripting language. ๐ซถ
โ ๏ธ Warning bestie, real talk: since this language uses characters that most shells interpret, it is necessary to use single quotes around strings! This is of course not the case when using config files. Don't get caught lacking by your shell ๐
Getting help on all actions and their options ๐
vdb_tool -help
Getting help on specific actions and their options ๐
vdb_tool -help read write
Getting help on all instructions ๐ง
vdb_tool -eval help="*"
Getting help on specific instructions โจ
vdb_tool -eval help=if,switch
Hello-world example ๐ธ โ create a level set sphere and save it to a file
vdb_tool -sphere -write sphere.vdb
Hello-world example with option ๐ โ same example but with options to save the file in half-float precision
vdb_tool -sphere -write bits=16 sphere.vdb
Converting a mesh into a level set ๐ฆ โ convert a polygon mesh file into a narrow-band level and save it to a file
vdb_tool -read mesh.obj -mesh2ls -write level_set.vdb
Read multiple files ๐ญ โ convert a polygon mesh file into a narrow-band level with a transform that matches a reference vdb
vdb_tool -read mesh.obj,reference.vdb -mesh2ls vdb=0 -write level_set.vdb
Convert a sequence of files ๐ฅ โ convert 5 polygon mesh files, "mesh_00{1,2,3,4,5}.obj", into separate narrow-band levels and save them to the files "level_set_0{1,2,3,4,5}.vdb"
Note that the value of loop variables is accessible with a preceding $ character and that the end of the for-loop (here 6) is exclusive. The instruction pad0 add zero-padding and takes two arguments, the string to pad and the desired length after padding.
vdb_tool -for n=1,6 -read mesh_'{$n:3:pad0}'.obj -mesh2ls -write level_set_'{$n:2:pad0}'.vdb -end
Loop over specific files ๐
Convert 5 polygon mesh files, "bunny.obj,teapot.ply,car.stl", into the Alembic files "mesh_0{1,2,3,4,5}.vdb". Note that all loop variables have a matching counter defined with a preceding # character.
vdb_tool -each file=bunny.obj,teapot.ply,car.stl -read '{$file}' -write mesh_'{$#file:1:+:2:pad0}'.abc -end
Define voxel size from a loop-variable ๐
Generate 5 sphere with different voxel sizes and save them all into a single vdb file
vdb_tool -for v=0.01,0.06,0.01 -sphere voxel='{$v}' name=sphere_%v -end -write vdb="*" spheres.vdb
Specify which grids to write into a single file ๐
Generate 4 spheres named after their stack id, i.e. 3,2,1,0, and write only grid 0 and 2 to a file
vdb_tool -for i=0,5 -sphere name='{4:$i:-}' -end -write vdb=2,0 tmp.vdb
Define options with simple math expression ๐
Read both a vdb and mesh file and convert the mesh to a vdb with twice the voxel size of the input vdb.
vdb_tool -read bunny.vdb dragon.ply -mesh2ls voxel='{0:voxelSize:2:*}' -print
Define options with complex math expressions โญ
Generate spheres that are rotating along a parametric circle
vdb_tool -for degree=0,360,10 -eval '{$degree:d2r:@radian}' -sphere center='({$radian:cos},{$radian:sin},0)' name=sphere_'{$degree}' -end -write vdb="*" spheres.vdb
Meshing of particles ๐ซถ
Converts input points in the file points.[obj|ply|abc|pts] to a level set, perform level set actions, and written to it the file surface.vdb:
vdb_tool -read points.[obj|ply|abc|pts] -points2ls -dilate -gauss -erode -write surface.vdb
Changing global default options ๐
Example with many properties of scalar and vector fields
vdb_tool -default keep=true -sphere -curvature -grad -curl -div -length v=1 -debug
If-statement to isolate level sets ๐
Read multiple grids, and render only level set grids
vdb_tool -read boat_points.vdb -for v=0,'{gridCount}' -if '{$v:isLS}' -render vdb='{$v}' -end -end
Use shell-script to define list of files ๐ง
Find and render thumbnails of all level sets in an entire directory structure
vdb_tool -each file=`find ~/dev/data -name '*.vdb'` -read '{$file}' -for grid=0,'{gridCount}' -if '{$grid:isLS}' -render vdb='{$grid}' thumbnail_'{$grid:gridName}'.ppm image=256x256 keep=1 -end -end -clear -end
Most of the arguments should be self-explanatory, but at least two deserve an explanation: -render has the option keep=1 because otherwise rendered grids are removed from the stack which invalidates {gridCount}, and -clear is added to avoid accumulating all grids as multiple files are loaded. ๐ (no cap, that keep=1 is doing SO much work here)
๐ฆ PIPELINING ๐ฆ
vdb_tool supports unix-style pipelining, which is especially useful for interactive viewing. Specifically, vdb_tool can read VDB grids from stdin or write VDB grid to stdout. Here are some examples:
Redirection of stdout and stdin ๐ธ
vdb_tool -sphere -o stdout.vdb > sphere.vdb
vdb_tool -i stdin.vdb -print < bunny.vdb
cat bunny.vdb | vdb_tool -i stdin.vdb -print
vdb_tool -sphere -o stdout.vdb | gzip > sphere.vdb.gz
gzip -dc sphere.vdb.gz | vdb_tool -i stdin.vdb -print
Pipelining multiple instances of vdb_tool โจ
vdb_tool -sphere -o stdout.vdb | vdb_tool -i stdin.vdb -dilate -o stdout.vdb > sphere.vdb
or with explicit semantics
vdb_tool -sphere -o stdout.vdb | vdb_tool -i stdin.vdb -dilate -o stdout.vdb > sphere.vdb
Note that the example above is slow due to serialization of the VDB grid.
vdb_tool -sphere -dilate -o stdout.vdb > sphere.vdb
or with explicit semantics
vdb_tool -sphere -dilate -o stdout.vdb > sphere.vdb
Pipelining vdb_tool with vdb_view for interactive viewing ๐
vdb_tool -sphere -dilate -o stdout.vdb | vdb_view
View a sequence of scaling, rotating, and translated tetrahedra ๐ฅ
vdb_tool -for t=0,6.28,0.2 -platonic f=4 -transform vdb=0 scale='{$t:sin:2:+}' rotate='(0,0,{$t})' translate='({$t:cos:5:*},{$t:sin:5:*},0)' -end -o stdout.vdb | vdb_view
View a sequence of spheres deformed in an analytical fluid field ๐
vdb_tool -sphere d=80 r=0.15 c=0.35,0.35,0.35 -for i=1,20 -enright dt=0.05 k=1 -end -o stdout.vdb | vdb_view
View a sequence of octahedrons deformed in an analytical fluid field ๐
vdb_tool -platonic d=128 f=8 s=0.15 c=0.35,0.35,0.35 -for i=1,20 -enright dt=0.05 k=1 -end -o stdout.vdb | vdb_view
Production example of meshing of fluid particles ๐
Generate adaptive meshes from a sequence of points files, points_0[200,299].vdb, and use mesh_mask.obj to clip off boundaries. Points are first rasterized as level set spheres, then dilates, filtered and eroded and finally meshed using the mask.
vdb_tool -read mesh_mask.obj -mesh2ls voxel=0.1 width=3 -for n=200,300,1 -read points_{$n:4:pad0}.vdb -vdb2points -points2ls voxel=0.035 radius=2.142 width=3 -dilate radius=2.5 space=5 time=1 -gauss iter=2 space=5 time=1 size=1 -erode radius=2.5 space=5 time=1 -ls2mesh vdb=0 mask=1 adapt=0.005 -write mesh_{$n:4:pad0}.abc -end
Production example with complex math โญ
Union 200 level set spheres scattered in a spiral pattern and ray-trace them into an image
vdb_tool -for n=0,200,1 -eval '{$n:137.5:*:@deg}' -eval '{$deg:d2r:@radian}' -eval '{$radian:cos:@x}' -eval '{$radian:sin:@y}' -eval '{$n:sqrt:@r}' -eval '{$r:5:+:@r_sum}' -eval '{$r_sum:0.25:pow:@pow_r}' -sphere voxel=0.1 radius='{$pow_r:0.5:*}' center='({$r:$x:*},{$r:$y:*},0)' -if '{$n:0:>}' -union -end -end -render spiral.ppm image=1024x1024 translate='(0,0,40)'
๐ AUTHOR ๐
This manual page was written by Mathieu Malaterre <malat@debian.org> for the Debian GNU/Linux system (but may be used by others).
and that's the whole thing bestie, we did it ๐ this was vdb_tool version 10.0.1, dated August 2026, and it lives at VDB_TOOL(1). go forth and pipeline, ily, bye ๐โจ
๐ฆ where this page comes from
- ubuntu stonking: libopenvdb-tools 10.0.1-4 ยท MPL-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms