vdb_tool 10.8.0

# This example demonstrates how to simplify a polygon mesh by round-tripping
# it through a narrow-band level set and re-meshing it with adaptive
# decimation. Reading from a PLY file, converting to a level set, then
# extracting an adaptive polygon mesh produces fewer, larger polygons in
# flat regions while preserving detail near high-curvature features.

# Read polygon mesh from binary PLY file
read bunny.ply

# Mesh to level set conversion:
#   dimension is 256 voxels along the longest axis
#   narrow-band half-width is 3 voxel units
mesh2ls dim=256 width=3

# Level set to polygon mesh conversion:
#   mesh adaptivity is 0.25 % (higher value = more aggressive simplification)
ls2mesh adapt=0.25

# Write polygon mesh to binary PLY file
write bunny_simplified.ply
