Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

PLY File Format

📅 2011-Aug-18 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ ply ⬩ 📚 Archive

 

The Polygon File Format (PLY) is one of the simplest formats to read or write a 3D mesh. It has both ASCII and binary formats, but we look at only the human-readable ASCII format here.

Consider a tetrahedron composed of these 4 points:

1.2 2.9 15.7
132.4 239.4 139.9
152.9 62.9 20.4
81.9 217.7 65.9

The simplest PLY file representing this tetrahedron would be:

ply
format ascii 1.0
element vertex 4
property float x
property float y
property float z
element face 4
property list uchar int vertex_index
end_header
1.2 2.9 15.7
132.4 239.4 139.9
152.9 62.9 20.4
81.9 217.7 65.9
3 0 1 2
3 0 1 3
3 0 2 3
3 1 2 3

It is easy to deduce the file format from the above representation:

PLY files can be opened and rendered in applications like MeshLab. PLY files can have many other features, please refer to the Wikipedia page for those details.