LinuxCommandLibrary

meshlabserver

Process and convert 3D meshes in batch

TLDR

Convert an STL file to an OBJ file

$ meshlabserver -i [input.stl] -o [output.obj]
copy

Convert a WRL file to a OFF file, including the vertex and face normals in the output mesh
$ meshlabserver -i [input.wrl] -o [output.off] -om vn fn
copy

Dump a list of all the available processing filters into a file
$ meshlabserver -d [path/to/file]
copy

Process a 3D file using a filter script created in the MeshLab GUI (Filters > Show current filter script > Save Script)
$ meshlabserver -i [input.ply] -o [output.ply] -s [filter_script.mlx]
copy

Process a 3D file using a filter script, writing the output of the filters into a log file
$ meshlabserver -i [input.x3d] -o [output.x3d] -s [filter_script.mlx] -l [logfile]
copy

SYNOPSIS

meshlabserver [OPTIONS]

PARAMETERS

-i
    Specifies the path to the input 3D mesh file.

-o
    Specifies the path for the output 3D mesh file. The format is inferred from the extension.

-s
    Applies a MeshLab script (.mlx file) containing a sequence of filters to be executed.

-p
    Loads a MeshLab project (.mlp file) as input, which can contain multiple meshes and their properties.

-om
    Defines what components of the mesh should be saved in the output. E.g., vc (vertex colors), vn (vertex normals), ft (face textures).

-m
    Similar to -om, specifies the mesh components to save. This option is deprecated in newer versions, replaced by -om.

-l
    Redirects verbose output and error messages to the specified log file.

-v
    Sets the verbosity level of the output (0 for silent, 1 for errors, 2 for warnings, 3 for info, 4 for debug).

-a =,=...
    Allows passing arbitrary parameters to filters within a script. Useful for dynamic filter configuration.

--help
    Displays a help message with available command-line options and usage information.

DESCRIPTION

meshlabserver is the headless, command-line version of the popular 3D mesh processing software MeshLab. It enables users to perform various operations on 3D models, such as format conversion, simplification, cleaning, merging, and filtering, without the need for a graphical user interface. This makes it ideal for batch processing, scripting, and integration into automated workflows on servers or compute clusters.

It supports a wide range of 3D file formats for input and output, including PLY, STL, OBJ, OFF, and 3DS. Its core functionality revolves around applying a sequence of filters defined in an XML-based MeshLab script (.mlx file), allowing complex processing pipelines to be automated.

CAVEATS

Memory usage can be substantial for large 3D models, potentially leading to out-of-memory errors.
Creating effective .mlx filter scripts often requires prior knowledge of MeshLab's GUI and filter parameters.
Error messages from filters can sometimes be cryptic, making debugging challenging in a headless environment.

MESHLAB SCRIPT FILES (<I>.MLX</I>)

These XML-based files are fundamental for meshlabserver. They define a sequence of filters with their specific parameters, allowing complex processing workflows to be automated. Users typically create and fine-tune these scripts within the graphical MeshLab application before utilizing them with meshlabserver for batch operations.

OUTPUT MODES (<I>-OM</I>)

The -om option provides granular control over which mesh components (e.g., vertex colors, normals, texture coordinates, face colors) are preserved and saved in the output file. Understanding and correctly using these flags is crucial for maintaining data integrity and desired visual properties during model conversions and transformations.

HISTORY

MeshLab was developed by the Visual Computing Lab of ISTI-CNR, originally as a project for managing and processing large 3D scans. meshlabserver was introduced to extend MeshLab's powerful processing capabilities to a non-interactive, command-line environment, addressing the need for batch operations, scripting, and integration into automated server-side workflows. Its development is continuous, with ongoing improvements and new filter additions.

SEE ALSO

blender(1), open3d (Python library for 3D data processing), CloudCompare (another 3D point cloud/mesh processing tool)

Copied to clipboard