PLY
Polygon File Format
Aka ply, a versatile 3D model format designed to store data from 3D scanners. It supports a wide range of properties, including color, transparency, surface normals, and texture coordinates. PLY is known for its simplicity and flexibility, making it a popular choice in various applications.
Overview
Developed by Greg Turk and others at Stanford University in 1994, PLY is also referred to as the Stanford Triangle Format. It efficiently describes 3D objects using flat polygons, offering both ASCII and binary versions for different use cases.
Details
Header
Begins with a header that specifies the file’s elements and their types. The header starts with a magic number ply and includes the format version, such as format ascii 1.0 or format binary_little_endian 1.0. Comments can be added using the comment keyword.
Elements
Elements define the structure of the 3D model, typically including vertices and faces. Each element is declared with its type and count, followed by properties that describe its attributes. For example:
element vertex 12
property float x
property float y
property float z
Properties
Properties describe the attributes of each element, such as position, normals, and texture coordinates. Data types include char, int, float, and list for collections. For instance, a face element might use a list to reference vertex indices.
ASCII vs. Binary
- ASCII: Human-readable, suitable for small models and easy debugging.
- Binary: Compact and efficient for large datasets, with endianess specified in the header.
####E xample The following example describes a cube mesh:
ply
format ascii 1.0
comment Created in Blender version 4.4.0
element vertex 14
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float s
property float t
element face 6
property list uchar uint vertex_indices
end_header
1 1 1 0.5773503 0.5773503 0.5773503 0.625 0.5
-1 1 1 -0.5773503 0.5773503 0.5773503 0.875 0.5
-1 -1 1 -0.5773503 -0.5773503 0.5773503 0.875 0.75
1 -1 1 0.5773503 -0.5773503 0.5773503 0.625 0.75
1 -1 -1 0.5773503 -0.5773503 -0.5773503 0.375 0.75
-1 -1 1 -0.5773503 -0.5773503 0.5773503 0.625 1
-1 -1 -1 -0.5773503 -0.5773503 -0.5773503 0.375 1
-1 -1 -1 -0.5773503 -0.5773503 -0.5773503 0.375 0
-1 -1 1 -0.5773503 -0.5773503 0.5773503 0.625 0
-1 1 1 -0.5773503 0.5773503 0.5773503 0.625 0.25
-1 1 -1 -0.5773503 0.5773503 -0.5773503 0.375 0.25
-1 1 -1 -0.5773503 0.5773503 -0.5773503 0.125 0.5
1 1 -1 0.5773503 0.5773503 -0.5773503 0.375 0.5
-1 -1 -1 -0.5773503 -0.5773503 -0.5773503 0.125 0.75
4 0 1 2 3
4 4 3 5 6
4 7 8 9 10
4 11 12 4 13
4 12 0 3 4
4 10 9 0 12
In this examples 14 vertices with positions, normals, and texture coordinates, followed by 6 faces each referencing four vertices.
History
PLY was inspired by the Wavefront OBJ format but offers greater extensibility. It supports arbitrary properties and groupings, making it adaptable to various applications.