PLY (file format)
Encyclopedia
PLY is a computer file format known as the Polygon File Format or the Stanford Triangle Format.
The format was principally designed to store three dimensional data from 3D scanners. It supports a relatively simple description of a single object as a list of nominally flat polygons. A variety of properties can be stored including: color and transparency, surface normals, texture coordinates and data confidence values. The format permits one to have different properties for the front and back of a polygon.
There are two versions of the file format
, one in ASCII
, the other in binary
.
Files are organised as a header, that specifies the elements of a mesh and their types, followed by the list of elements itself, usually vertices and faces - potentially other entities such as edges, samples of range maps, and triangle strips can be encountered.
The header of both ASCII and binary files is ASCII text. Only the numerical data that follows the header is different between the two versions.
The header always starts with a "magic number", a line containing
ply
which identifies the file as a PLY file. The second line indicates which variation of the PLY format this is. It should be one of:
format ascii 1.0
format binary_little_endian 1.0
format binary_big_endian 1.0
Future versions of the standard will change the revision number at the end - but 1.0 is the only version currently in use.
Comments may be placed in the header by using the word
comment This is a comment!
The 'element' keyword introduces a description of how some particular data element is stored and how many of them there are. Hence, in a file where there are 12 vertices, each represented as a floating point (X,Y,Z) triple, one would expect to see:
element vertex 12
property float x
property float y
property float z
Other 'property' lines might indicate that colours or other data items are stored at each vertex and indicate the data
type of that information. Regarding the data type there are two variants, depending on the source of the ply file, the type can be specified with one of char uchar short ushort int uint float double, or one of int8 uint8 int16 uint16 int32 uint32 float32 float64. For an object with ten polygonal faces, one might see:
element face 10
property list uchar int vertex_index
The word 'list' indicates that the data is a list of values–the first of which is the number of entries in the list (represented as a 'uchar' in this case) and each list entry is (in this case) represented as an 'int'.
At the end of the header, there must always be the line:
end_header
In the ASCII version of the format, the vertices and faces are each described one to a line with the numbers separated by white space. In the binary version, the data is simply packed closely together at the 'endianness' specified in the header and with the data types given in the 'property' records. For the common "property list..." representation for polygons, the first number for that element is the number of vertices that the polygon has and the remaining numbers are the indices of those vertices in the preceding vertex list.
and others in the Stanford graphics lab under the direction of Marc Levoy. Its design was inspired by the Wavefront .obj format, but the Obj format lacked extensibility for arbitrary properties and groupings, so the "property" and "element" keywords were devised to generalize the notions of vertices, faces, associated data, and other groupings.
The format was principally designed to store three dimensional data from 3D scanners. It supports a relatively simple description of a single object as a list of nominally flat polygons. A variety of properties can be stored including: color and transparency, surface normals, texture coordinates and data confidence values. The format permits one to have different properties for the front and back of a polygon.
There are two versions of the file format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...
, one in ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
, the other in binary
Binary file
A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text...
.
The File Format
A complete description of the PLY format is beyond the scope of this article - but one may obtain a good understanding of the basic concepts from the following description:Files are organised as a header, that specifies the elements of a mesh and their types, followed by the list of elements itself, usually vertices and faces - potentially other entities such as edges, samples of range maps, and triangle strips can be encountered.
The header of both ASCII and binary files is ASCII text. Only the numerical data that follows the header is different between the two versions.
The header always starts with a "magic number", a line containing
ply
which identifies the file as a PLY file. The second line indicates which variation of the PLY format this is. It should be one of:
format ascii 1.0
format binary_little_endian 1.0
format binary_big_endian 1.0
Future versions of the standard will change the revision number at the end - but 1.0 is the only version currently in use.
Comments may be placed in the header by using the word
comment
at the start of the line. Everything from there until the end of the line should then be ignored. e.g.:comment This is a comment!
The 'element' keyword introduces a description of how some particular data element is stored and how many of them there are. Hence, in a file where there are 12 vertices, each represented as a floating point (X,Y,Z) triple, one would expect to see:
element vertex 12
property float x
property float y
property float z
Other 'property' lines might indicate that colours or other data items are stored at each vertex and indicate the data
type of that information. Regarding the data type there are two variants, depending on the source of the ply file, the type can be specified with one of char uchar short ushort int uint float double, or one of int8 uint8 int16 uint16 int32 uint32 float32 float64. For an object with ten polygonal faces, one might see:
element face 10
property list uchar int vertex_index
The word 'list' indicates that the data is a list of values–the first of which is the number of entries in the list (represented as a 'uchar' in this case) and each list entry is (in this case) represented as an 'int'.
At the end of the header, there must always be the line:
end_header
In the ASCII version of the format, the vertices and faces are each described one to a line with the numbers separated by white space. In the binary version, the data is simply packed closely together at the 'endianness' specified in the header and with the data types given in the 'property' records. For the common "property list..." representation for polygons, the first number for that element is the number of vertices that the polygon has and the remaining numbers are the indices of those vertices in the preceding vertex list.
History
The PLY format was developed in the mid-90s by Greg TurkGreg Turk
Greg Turk is an American-born researcher in the field of computer graphics and a Professor at the School of Interactive Computing in the College of Computing at the Georgia Institute of Technology...
and others in the Stanford graphics lab under the direction of Marc Levoy. Its design was inspired by the Wavefront .obj format, but the Obj format lacked extensibility for arbitrary properties and groupings, so the "property" and "element" keywords were devised to generalize the notions of vertices, faces, associated data, and other groupings.
See also
- STL (file format)STL (file format)STL is a file format native to the stereolithography CAD software created by 3D Systems. This file format is supported by many other software packages; it is widely used for rapid prototyping and computer-aided manufacturing. STL files describe only the surface geometry of a three dimensional...
- Additive Manufacturing File FormatAdditive Manufacturing File FormatAdditive Manufacturing File Format is an open standard for describing objects for additive manufacturing processes such as 3D printing. The official ASTM F2915standard is an XML-based format designed to allow any computer-aided design software to describe the shape and composition of any 3D object...
- Wavefront .obj file, a 3D geometry definition file format with .obj file extension
- MeshLabMeshLabMeshLab, is a free 3D mesh processing software program; MeshLab, started in late 2005, is an open-source general-purpose system aimed to help the processing of the typical not-so-small unstructured 3D models that arise in the pipeline of processing of the data coming from 3D scanning...
: an open source Windows, Mac OS X and Linux application for visualizing, processing and converting three dimensional meshes to or from the PLY file format. - MathematicaMathematicaMathematica is a computational software program used in scientific, engineering, and mathematical fields and other areas of technical computing...
A technical computing system that can work with PLY files.