At VIM we process extremely large architectural models and import meshes and BIM data into game engines (such as Unity), 3D editing tools (such as 3ds Max), and applications running on different devices (such as the Magic Leap).

When using FBX as a format for representing large meshes it takes close to four minutes to import a 28 million polygon model in Unity. As an alternative we developed an open format for representing 3D geometry called G3D, which improved import time to just under 6 seconds.

Overview

The G3D format can represent triangular and quadrilateral meshes, point clouds, line segments, and polygonal meshe along with arbitrary attributes (e.g. normals, UVs, colors, smoothing groups, etc.) associated with different sub-elements of the mesh (vertices, faces, face-corners, polygon groups, or whole object).

Our G3D loader is over an order of magnitude faster in our tests than reading OBJ, FBX, or PLY files with the Assimp model import library or into Unity. The specification and reference implementation is also considerably simpler than other binary formats such as glTF while supporting a wider range of data attributes.

Our G3D loader is over an order of magnitude faster in our tests than reading OBJ, FBX, or PLY files with the Assimp model import library or into Unity. The specification and reference implementation is also considerably simpler than other binary formats such as glTF while supporting a wider range of data attributes.

On the G3D Github repo we provide a reference implementation in C# using .NET Standard 2.0 (making it cross-platform) and a Unity test project for importing and exporting G3D meshes. We also have released a Nuget package which we use in our production code.

Motivation

The common de-facto data formats for representing 3D geometry (e.g. OBJ, FBX, Collada, glTF, etc.) generally have significant room for improvement in one more of the following areas:

serialization and deserialization performance

not cross platform

extensibility

simplicity of implementation

limits on number and types of attributes stored

Our goal was a format that would enable us to quickly and easily develop importers and exporters as plug-ins to different editing tools, game engines, and applications running on different platforms from desktop to WebGL to spatial computing devices like the Magic Leap.

We also wanted this format to be able to transport a wide variety of data from different sources without loss.

How is G3D so fast?

The reason the G3D format is so fast is that it doesn’t have to pre-process data before getting it into a renderable (GPU friendly) state.

Text-based mesh formats such as OBJ, PLY, Collada, etc. require the computer to spend a significant amount of time converting from a text-representation to a binary representation consumable by the converter.

Similarly some binary formats like FBX the mesh vertex data is organized as a vectors 4 of double-precision floating point values. Most rendering contexts expect the vertex position data to be encoded as groups of 3 single-precision floats, which means that a pre-process step including a re-allocation of memory must be done, to truncate the data and pack it in more convenient format.

G3D data buffers are strictly aligned, so that once the entire file is loaded into memory, the individual data buffers can be passed to the GPU as-is with no additional processing or memory allocations.

A Primer on 3D Meshes

Commonly a 3D mesh consists of a series of points in space (called vertices) and a list of faces that specify how those points are connected to make a faceted surface in 3 dimensional space.