0
\$\begingroup\$

I have been looking around for a file format that saves models as a collection of primitives (Boxes, Spheres, Cones, Cylinders, etc.). After some research, I came to the conclusion that pretty much every standard available file format saves models as a collection of vertices and indices (and some other stuff like UVs & materials).

Real world example
Why would one need a file format that saves primitives? Well, in my case, I am trying to build a game where I will need to import the physics separately. Since physics are optimized per primitive type, I would deem it wise to not just import everything as a mesh collider but make use of these optimizations.
For context, I am using Three.js with Ammo.js (Bullet) running server-side.

Standard
So the question really is, why is there no standard for this? Why isn't there a standard like SVG but for 3d models? I will probably end up writing my own format / implementation, so it's not like it's holding me back. It's just that I am a bit cautious, since I feel that there probably is a reason for no such standard to exist.

Related links
Here are some links I came across during research:
http://wiki.laptop.org/go/Physics_File_Format
http://bulletphysics.org/mediawiki-1.5.8/index.php/Bullet_binary_serialization

Edit:
Since comments aren't for thanking people, I'll just do that here. Thanks to all of you that answered and commented, very insightful! Much appreciated!

\$\endgroup\$
  • \$\begingroup\$ This looks like a tough question for any one person to answer. I could tell you why I haven't proposed such a format, but to explain why no one has proposed such a format you'd need to ask... everyone. Since you say you can write your own format tailored to your needs, does it matter why nobody else did it first? Maybe you can be the one to create and publish this format and see if it catches on! \$\endgroup\$ – DMGregory May 29 '18 at 17:22
  • \$\begingroup\$ It's often times a asset/production pipeline issue which are mostly designed around specific needs and requirements. Even if you had a "standard" you'd still be parsing it to your game engine as need be. \$\endgroup\$ – Sidar May 29 '18 at 17:37
  • 1
    \$\begingroup\$ Perhaps it is about keyword choice? For example check open CSG. Wikipedia mentions dozens of applications supporting CSG input - I bet at least half of them have their own format. (plus possibly tens to hundreds other formats lingering in proprietary or academia applications) \$\endgroup\$ – wondra May 29 '18 at 17:57
0
\$\begingroup\$

There has been at least one that I know of: VRML. I believe its predecessor X3D also supported geometric primitives.

That being said, there's a number of reasons why formats favor a vertex approach over a geometric primitive approach:

  1. Universality - All models can be described as vertex meshes, including those made from geometric primitives, but the reverse isn't true - it's possible to have a mesh that isn't well defined as a collection of primitives.
  2. Direct usage - Modern graphics hardware is not oriented to directly render geometric primitives. They need to be converted into vertex mesh first. Using a format that support that directly cuts down some work.
  3. Control - Related to the last point, for a given geometric primitive, there are a number of different ways it can be represented as a vertex mesh. By directly representing the mesh, you have the more control over exactly how it should be represented. For instance, a UV sphere & an icosphere are both ways to represent a sphere. By representing the mesh directly, you have support for both as well as application specific hybrids.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.