ply2vri is a simple command line tool for converting triangle meshes in
format into signed-distance volumetric grids in
This is particularly useful if you want to
try out Stanford's
The current release is version 1.1. The zip file includes a Windows
executable, source code, Visual Studio project
file, and Linux makefile:
The command line parameters for ply2vri are:
ply2vri [<options>] <input file> [<output file>]
The input file should be a PLY file containing a triangle mesh or
triangle strips. The form of the output depends on the extension
The possible options are as follows:
- .vri (or no ouput file given): The volumetric grid
will be saved in Stanford's vrip format.
- .ppm: The volumetric grid will be saved in PPM image
form, as a long strip of cross-sections (similar to the example output
towards the bottom of this page).
- .raw: The raw unexpanded volumetric grid will
be dumped in an undocumented format.
- -r: Specifies the voxel resolution, e.g.,
-r0.005 indicates that the edge length of each voxel
will be 0.005 units in the PLY file's coordinate system.
- -l: Specifies the ramp length, e.g.,
-l5 indicates that 5 voxels in each direction from
the surface will be marked.
This optional parameter specifies the
ramp length, i.e,., the number of voxels that will be marked in each direction
from the surface.
The distance from the surface is saved as an unsigned
short (range 0 to 65535), so 32767 indicates a voxel located on the surface,
0 indicates a voxel located ramp_length * resolution outside the surface,
and 65535 indicates a voxel located ramp_length * resolution inside the
ramp length = 5
ramp length = 10
- -h: -h1 (the default) enables hard
edges. This means that voxels whose closest surface
point is at the boundary of the triangle mesh are marked as empty.
-h0 will fill in the true signed distance to the surface,
even at boundaries (note that the sign is poorly defined in some
Look at the hole in the bottom of the rabbit in this example:
- -s: Often the triangles near a hole
are innaccurate and so you may want to throw them away. This optional parameter
lets you specify how many times you want to remove all triangles that
are adjacent to a hole, e.g., -s1 removes one layer of triangles
from around the edge before scan converting.
- -a: The default algorithm (-a0) iterates
over each triangle and splats in the distance for each voxel within
a radius of the ramp length (similar to a z-buffer algorithm).
-a1 uses an alternate algorithm that uses a KD-tree-like structure
to find the closest point at each voxel. This second algorithm may
be faster in some situations (especially if your ramp lengths are very
- -v: This option lets you specify a VRI file
(e.g. -vfoo.vri) that will be used to provide space-carving
information. The resolution and position of the voxel grid are extracted
from the VRI file, and then after scan conversion any voxels marked as
empty (value = 0, weight = 0) will be copied into the output.
Below is an example of an input triangle mesh and the resulting
volumetric distance field, displayed as a series of cross-sections:
This software is Copyright (c) 2002 University of Washington. Use
at your own risk. The full license for this software can be found here:
Last updated: Friday, October 31, 2002.