vdb_tool 10.8.0

# Define the range of frames over which to iterate. The for-loop variable
# 'n' takes the values 100, 101, ..., 109 (the upper bound is exclusive).
# See the read and write actions below for how 'n' is used to format
# zero-padded frame numbers in filenames.
for n=100,110,1

# Read each frame of the OpenVDB point file:
# "fluid_points.0100.vdb", "fluid_points.0101.vdb", ..., "fluid_points.0109.vdb"
read fluid_points.{$n:4:pad0}.vdb

# Extract geometry points from the VDB grid
vdb2points

# Convert points to a narrow-band level set:
#   dimension is 256 voxels along the longest axis
#   particle radius is 2.0 voxels
#   narrow-band half-width is 3 voxel units
points2ls dim=256 radius=2 width=3

# Dilate level set:
#   radius of dilation is 1.0 voxels
#   spatial discretization is 5th-order WENO
#   temporal discretization is 1st-order TVD-RK
dilate radius=1 space=5 time=1

# Gaussian filtering of level set:
#   number of iterations is 1
#   spatial discretization is 5th-order WENO
#   temporal discretization is 1st-order TVD-RK
#   filter-kernel size is 1.0 voxels
gauss iter=1 space=5 time=1 size=1

# Erode level set:
#   radius of erosion is 1.0 voxels
#   spatial discretization is 5th-order WENO
#   temporal discretization is 1st-order TVD-RK
erode radius=1 space=5 time=1

# Level set to polygon mesh conversion:
#   mesh adaptivity is 0.1 %
ls2mesh adapt=0.1

# Write each frame as a binary PLY file:
# "surface-100.ply", "surface-101.ply", ..., "surface-109.ply"
write surface-{$n:3:pad0}.ply

# End for-loop
end
