Overview of the OFF File Format
The OFF (Object File Format) is a lightweight, human-readable, ASCII-based file format designed to describe the geometry of 2D or 3D objects, primarily through collections of polygons (faces) defined by vertices. Developed in the late 1980s (notably associated with projects at Ohio State University and later popularized by the Geomview interactive 3D viewer from the Geometry Center at the University of Minnesota), OFF remains widely used today in academic research, mesh processing libraries (e.g., CGAL, MeshLab, libigl), 3D benchmarks (e.g., Princeton Shape Benchmark), and tools for surface reconstruction, visualization, and computational geometry.
OFF is intentionally simple and extensible, focusing on polygonal meshes without built-in support for textures, materials, animations, or hierarchies (unlike OBJ, PLY, or more complex formats like FBX or glTF). It excels in scenarios requiring clean, topology-focused geometry exchange—such as finite element analysis, computer vision shape analysis, or 3D printing preprocessing.
Key Features and Structure
- ASCII by default (binary variants exist but are less common and not universally supported).
- Supports arbitrary polygonal faces (not just triangles; n-gons allowed).
- Optional per-vertex or per-face colors (RGBA), normals, and other extensions (prefixed with lines like "COFF", "NOFF", "CNOFF", etc.).
- Can represent 2D polygons, 3D polyhedra, or even higher-dimensional objects in extended forms.
- No units or coordinate system metadata—coordinates are abstract floats.
- Minimal header; easy to parse manually or programmatically.
Standard OFF File Structure
A basic OFF file follows this layout:
- First line (magic header):
OFF(sometimes omitted in very old files, but recommended). - Second line: Three integers:
n_vertices n_faces n_edges
(n_edges is often set to 0 and ignored by readers; historically included for Euler characteristic checks.) - Next n_vertices lines: Vertex coordinates
Each:x y z(floating-point values, one vertex per line) - Next n_faces lines: Face definitions
Each starts with an integer v (number of vertices in the face), followed by v zero-based indices into the vertex list:
v idx1 idx2 ... idxv
Faces are assumed to be planar and non-self-intersecting; winding order typically counterclockwise for front-facing.
Example: A simple cube (8 vertices, 6 quadrilateral faces)
OFF
8 6 0
-0.5 -0.5 0.5
0.5 -0.5 0.5
0.5 0.5 0.5
-0.5 0.5 0.5
-0.5 -0.5 -0.5
0.5 -0.5 -0.5
0.5 0.5 -0.5
-0.5 0.5 -0.5
4 0 1 2 3
4 4 5 6 7
4 0 1 5 4
4 1 2 6 5
4 2 3 7 6
4 3 0 4 7
Extensions (Colored / Normals Variants)
- COFF: Colored OFF — vertices have RGBA after XYZ (e.g.,
x y z r g b a); faces can also have color. - NOFF: Normals OFF — vertices have normal vector after XYZ (e.g.,
nx ny nz x y z). - CNOFF: Both colors and normals.
Many modern implementations (MeshLab, CGAL) support these; pure "OFF" readers ignore extra fields or fail gracefully.
Advantages and Limitations
Advantages: Extremely simple to read/write, no dependencies, human-editable, compact for basic meshes, supports arbitrary polygons (reduces triangulation artifacts in some workflows).
Limitations: No textures/UVs, no materials, no hierarchy/groups, no metadata (units, author, etc.), no binary efficiency for huge models (though binary OFF exists in some tools), faces must be convex/planar in practice for most renderers.
For more advanced needs, formats like PLY (with properties), OBJ (with MTL materials), or glTF are often preferred today. However, OFF remains a gold standard in geometry processing research and education due to its purity and ease of implementation.
Reference: Comprehensive description of the OFF format, including extensions and examples.