<p><a href="https://github.com/KhronosGroup/glTF" rel="nofollow noreferrer">GLTF</a> is a standardized 3D file format from the Khronos group, the same people behind OpenGL and Vulkan. It has both text and binary formats (the latter called GLB) and is a full-featured format, including support for vertex colors.</p>
<p><a href="https://github.com/syoyo/tinygltf" rel="nofollow noreferrer">tinygltf</a> is an example of a C++ library for loading and saving GLTF/GLB files, but there are many others, I'm sure.</p>

CC BY-SA 4.0
2021-07-21T21:40:35.283Z
2021-07-21T22:38:31.637Z
2021-07-21T22:38:31.637Z
Nathan Reed
<p>The <a href="https://www.cc.gatech.edu/projects/large_models/ply.html" rel="nofollow noreferrer">PLY file format</a> is a simple format similar to OBJ that allows arbitrary attributes (like colours) and has a binary mode.</p>

CC BY-SA 4.0
2020-02-27T18:56:46.997Z
The fact that it has an ASCII header for the binary format is a little frustrating, but I think I can work around that. Do you know how properties are handled for software that reads in PLY files? The header specifies where the properties are, what they apply to, and their size, but the names and types are arbitrary. How does any software deal with the fact that the colors could be called "red" "blue" and "green", or "rd" "bl" "gr" (or anything else), and they could be anything from uchar to float? How is that possible?
Tyler Shellberg
CC BY-SA 4.0
2020-02-27T19:02:29.490Z
As a sidenote, can colors even be applied to faces? Or is the only option to define them per-vertex, or do some kind of user-defined elements? This is all a little confusing.
Tyler Shellberg
CC BY-SA 4.0
2020-02-27T19:03:48.277Z
@TylerShellberg Unfortunately, you might have to rely on common practice for that, in the case of colours likely `uchar red`... That's the disadvantage of an entirely felxible file format like that.
Christian Rau
CC BY-SA 4.0
2020-02-27T16:20:57.617Z
2020-02-27T16:20:57.617Z
gilgamec
<p>FBX: while FBX is proprietary, it has both binary and text versions of the format, provides color support, and it provides an SDK which can make integration easier. <a href="https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0?AID=10282382&amp;PID=9069228&amp;SID=oc5A05L8E%2FcFrofF6SHThM2E3y3pj38LNvENP0hS0mILwHLVKKrvn%2B9SIG76o1vC&amp;mktvar002=afc_us_deeplink&amp;cjevent=fdb3a1a2ebc411eb816c01400a82b82d&amp;affname=9069228_10282382" rel="nofollow noreferrer">Here is a link.</a></p>

CC BY-SA 4.0
2021-07-23T14:50:24.913Z
2021-07-23T14:50:24.913Z
pmw1234
<p>I am looking for a file format to output some 3D geometry. In my case, it only needs to handle very simple shapes - uniformly spaced and sized cubes at points in space. So far I've ended up just representing them as triangles or quads depending on what I can use. </p>

<p>I've tried Binary STL format which is decently compact, but has no support for colors.</p>

<p>Wavefront Object format (OBJ) and the material library (MTL) work well for color support, but there is no binary version as far as I know - making it very bulky. </p>

<p>Is there a file format that:</p>

<ul>
<li>Is compact in size</li>
<li>Has some way to support colors</li>
<li>Can be opened by software like 3D Viewer, Paint 3D, or other common tools?</li>
</ul>

<3d><mesh>
Looking for a compact file format for outputting 3D geometry with color support
Tyler Shellberg
# Looking for a compact file format for outputting 3D geometry with color support

(Asked by: username_0 on 2020-02-27)

I am looking for a file format to output some 3D geometry. In my case, it only needs to handle very simple shapes - uniformly spaced and sized cubes at points in space. So far I've ended up just representing them as triangles or quads depending on what I can use.

I've tried Binary STL format which is decently compact, but has no support for colors.

Wavefront Object format (OBJ) and the material library (MTL) work well for color support, but there is no binary version as far as I know - making it very bulky.

Is there a file format that:

* Is compact in size
* Has some way to support colors
* Can be opened by software like 3D Viewer, Paint 3D, or other common tools?

**Tags:** 3d, mesh


---

## 3 answers

### Answer by username_1 on 2021-07-21. Score: 3

[GLTF](https://github.com/KhronosGroup/glTF) is a standardized 3D file format from the Khronos group, the same people behind OpenGL and Vulkan. It has both text and binary formats (the latter called GLB) and is a full-featured format, including support for vertex colors.

[tinygltf](https://github.com/syoyo/tinygltf) is an example of a C++ library for loading and saving GLTF/GLB files, but there are many others, I'm sure.


---

### Answer by username_2 on 2020-02-27. Score: 1

The [PLY file format](https://www.cc.gatech.edu/projects/large_models/ply.html) is a simple format similar to OBJ that allows arbitrary attributes (like colours) and has a binary mode.

> **Comments:**
> **username_0**: The fact that it has an ASCII header for the binary format is a little frustrating, but I think I can work around that. Do you know how properties are handled for software that reads in PLY files? The header specifies where the properties are, what they apply to, and their size, but the names and types are arbitrary. How does any software deal with the fact that the colors could be called "red" "blue" and "green", or "rd" "bl" "gr" (or anything else), and they could be anything from uchar to float? How is that possible?  
> **username_0**: As a sidenote, can colors even be applied to faces? Or is the only option to define them per-vertex, or do some kind of user-defined elements? This is all a little confusing.  
> **username_3**: @username_0 Unfortunately, you might have to rely on common practice for that, in the case of colours likely `uchar red`... That's the disadvantage of an entirely felxible file format like that.  

---

### Answer by username_4 on 2021-07-23. Score: 1

FBX: while FBX is proprietary, it has both binary and text versions of the format, provides color support, and it provides an SDK which can make integration easier. [Here is a link.](https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0?AID=10282382&PID=9069228&SID=oc5A05L8E%2FcFrofF6SHThM2E3y3pj38LNvENP0hS0mILwHLVKKrvn%2B9SIG76o1vC&mktvar002=afc_us_deeplink&cjevent=fdb3a1a2ebc411eb816c01400a82b82d&affname=9069228_10282382)


---

