Polygon File Format
Polygon File Format | |
---|---|
File extension : |
.ply
|
MIME type : | text / plain |
Magic number : | PLY |
Developed by: | Greg Turk , Stanford University |
Initial release: | 1994 |
Current version: | 1.0 |
Type: | ASCII format / binary file |
Container for: | 3D models |
The Polygon File Format ( PLY for short or also known as Stanford Triangle Format ) is a file format for storing three-dimensional data that was originally designed for use with 3D scanners .
The format is characterized by a simple description of individual objects as lists of polygons . Different attributes can be defined for the front and back of a polygon, such as: color , transparency , surface normals , texture coordinates or confidence values of measured data.
A PLY file can be saved in ASCII format or as a binary file.
File structure
The files begin with a header that specifies the elements of the mesh and their types. The list following the header contains elements such as vertices , triangles (faces) and edges.
In both the ASCII and the binary version of the file, the header always consists of ASCII characters, only the numerical part of the file is saved differently. The first line of the header consists only of the magic number :
ply
The second line specifies the format of the file and should be one of the following:
format ascii 1.0
format binary_little_endian 1.0
format binary_big_endian 1.0
The marking 1.0
refers to the version number of the standard used. 1.0
however, it is the only version currently in use.
The word comment
at the beginning of a line allows you to insert comments, everything that follows on the line is ignored:
comment Dies ist ein Kommentar!
The element
description of the elements used begins with the keyword, followed by their number.
For example, the following is in a file that contains 12 vertices, each of which is defined as a number triplet from (X, Y, Z) floats .
element vertex 12
property float x
property float y
property float z
Further property
lines of an element could also describe other data such as color values. It looks like this, for example:
property uchar red
property uchar green
property uchar blue
Please note that colors typically have the data type uchar
(unsigned char, i.e. integers with a value range from 0 to 255). If colors are mentioned in the header, each line contains not only the number triple (X, Y, Z) for the vertex position, but also a number triple for the colors (R, G, B).
There are two different notations for data types, which are specified as scalar variables or as a list , as above .
char, uchar, short, ushort, int, uint, float, double
are data types that can be used for scalar notation.
For the list notation you can choose from the purely numerical types int8, uint8, int16, uint16, int32, uint32, float32, float64
.
An object with ten polygon faces can be described with the list notation as follows:
element face 10
property list uchar int vertex_indices
The word list
signals the beginning of a list, the first entry in the list (in this case of the type uchar
) contains the number of elements in the list. All of the following entries are of the type int
.
The following line closes the header and is followed by the actual content of the file:
end_header
example
The following describes a simple cube in a PLY file in ASCII format and comes from the original file structure definition by Greg Turk .
ply
format ascii 1.0 { ascii/binary, format version number }
comment made by Greg Turk { comments keyword specified, like all lines }
comment this file is a cube
element vertex 8 { define "vertex" element, 8 of them in file }
property float x { vertex contains float "x" coordinate }
property float y { y coordinate is also a vertex property }
property float z { z coordinate, too }
element face 6 { there are 6 "face" elements in the file }
property list uchar int vertex_indices { "vertex_indices" is a list of ints }
end_header { delimits the end of the header }
0 0 0 { start of vertex list }
0 0 1
0 1 1
0 1 0
1 0 0
1 0 1
1 1 1
1 1 0
4 0 1 2 3 { start of face list }
4 7 6 5 4
4 0 4 5 1
4 1 5 6 2
4 2 6 7 3
4 3 7 4 0
ASCII or binary format
In the ASCII version of the format, vertices and faces are each described in one line, numerical values are separated by spaces. In binary format, the numerical values are simply summarized more compactly; the values can continue to be interpreted individually thanks to the endian specified in the header and the given data types of the property
attributes. The property list
notation for polygons provides for both versions that the first number indicates the vertex number of the polygon and the following list then lined up the vertex indices.
Emergence
The PLY format was developed by Greg Turk and others under the direction of Marc Levoy at Stanford University in the mid-1990s . The basic structure was inspired by the Wavefront OBJ format, which, however, did not offer the desired flexibility to formulate various additional information or groupings. As a result, the property
and element
keywords were introduced to generalize the description of vertices, polygons, associated data, and other groupings.
Related file formats
- OBJ - from Wavefront Technologies
- STL - Standard Triangulation / Tesselation Language
- OFF - Object File Format
Scientific software
for unstructured triangular grids in PLY format:
Program libraries and source texts
- PLY - Polygon File Format
- Collection of tools for processing PLY files (C code)
- rply - ANSI-C library for reading and writing PLY files (MIT license)
- libply - C ++ library for reading and writing PLY files (GNU license)
- C ++ library for reading and writing PLY files (GPL 3.0 license)
Data collections
- The Stanford 3D Scanning Repository - Collection of various 3D models in PLY format
- HeiCuBeDa - Collection of 1977 cuneiform tablets as 3D scans in high resolution for bulk download in PLY format
- HeiCu3Da - Searchable version of HeiCuBeDa with preview of the cuneiform tablets and the possibility to call up individual PLYs
Individual evidence
- ^ A b Greg Turk: The PLY Polygon File Format. (No longer available online.) Archived from the original on December 4, 2016 ; accessed on February 5, 2017 . Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ^ The Digital Michelangelo Project
- ↑ Hubert Mara and Bartosz Bogacz: Breaking the Code on Broken Tablets: The Learning Challenge for Annotated Cuneiform Script in Normalized 2D and 3D Datasets . In: Proceedings of the 15th International Conference on Document Analysis and Recognition ( ICDAR ) . Sydney, Australia 2019.