OFF Files
Geomview Object File Format

OFF is a data directory which contains examples of OFF files. An OFF file is good for storing a description a 2D or 3D object constructed from polygons. There is even a simple extension which can handle objects in 4D.

OFF File Characteristics:

While there are many variations and extensions of the OFF format, the simplest files have the following structure:

Line 1
Line 2
vertex_count face_count edge_count
One line for each vertex:
x y z
for vertex 0, 1, ..., vertex_count-1
One line for each polygonal face:
n v1 v2 ... vn,
the number of vertices, and the vertex indices for each face.
The vertices are implicitly numbered by the order of their listing in the file. The first vertex will have index 0, and the last will have index vertex_count-1. Comment lines may be inserted anywhere, and are denoted by the character # appearing in column 1. Blank lines are also acceptable.

Colors can be assigned to the vertices by following the XYZ coordinates of a vertex with the RGBA color coordinates (the "A" coordinate controls the transparency). In particular, this means that the form of the vertex lines would be:

One line for each colored vertex:
x y z r g b a
for vertex 0, 1, ..., vertex_count-1

Colors can be assigned to the faces by following the vertex indices by the RGBA color coordinates of the face. In particular, this means that the form of the face lines would be:

One line for each polygonal face:
n v1 v2 ... vn r g b a,
the number of vertices, the vertex indices, and the RGBA color coordinates for each face.

Normally, color is not specified for BOTH the vertices and faces. If the node colors are specified, then the faces are colored with a smooth interpolation of the colors of their vertices.

Example OFF file:

#  A cube.
#  There is extra RGBA color information specified for the faces.
8 6 12
  1.632993   0.000000   1.154701
  0.000000   1.632993   1.154701
 -1.632993   0.000000   1.154701
  0.000000  -1.632993   1.154701
  1.632993   0.000000  -1.154701
  0.000000   1.632993  -1.154701
 -1.632993   0.000000  -1.154701
  0.000000  -1.632993  -1.154701
  4  0 1 2 3  1.000 0.000 0.000 0.75
  4  7 4 0 3  0.300 0.400 0.000 0.75
  4  4 5 1 0  0.200 0.500 0.100 0.75
  4  5 6 2 1  0.100 0.600 0.200 0.75
  4  3 2 6 7  0.000 0.700 0.300 0.75
  4  6 5 4 7  0.000 1.000 0.000 0.75


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Related Data and Programs:

MESHLAB, examples which illustrate the use of the meshlab program, an advanced mesh processing system for automatic or user-assisted editing, cleaning, filtering, converting and rendering of large unstructured 3D triangular meshes. MESHLAB can read and write 3DS, OBJ, OFF, PLY, and STL graphics files.

OFF2PLC, a C++ program which reads an OFF file describing a surface in 3D, and creates an equivalent PLC file, by Alex Rand.


    the GEOMVIEW web site;

Sample Files:

You can go up one level to the DATA page.

Last revised on 09 June 2012.