3D formats overview: OBJ

Introduction

Fig. 1. OBJ format is widespread in the 3D graphics space, so it is often used for digital art assets.
Fig. 1. OBJ format is widespread in the 3D graphics space, so it is often used for digital art assets.

Technical details

OBJ is a text format and each line hosts an item definition. Items include things like vertices, texture coordinates, normals, faces, and groups. The items in each category are numbered implicitly starting with 1, making it possible, for example, for face definitions to reference vertices, texture coordinates, and normals. To apply colors, materials, and textures to items, these have to be defined in a separate MTL file, which can be referenced from the OBJ file (notice mtllib on Fig. 2). The MTL file is structured similarly, but the items here are materials and their parameters. Both OBJ and MTL files can contain comments, they are marked with pound (#) character. These are typically used to store the identification of exporting software and also some application-specific information (see that on Fig. 2 the exporter used the comment to define the units the model was written in).

Fig. 2. Left: contents of an OBJ file. Right: contents of an associated MTL file. The OBJ file begins with definition of a group and definitions of two faces inside it. The MTL file defines several colors.
Fig. 2. Left: contents of an OBJ file. Right: contents of an associated MTL file. The OBJ file begins with definition of a group and definitions of two faces inside it. The MTL file defines several colors.

Strengths and weaknesses

Time-proven, simple and universal

OBJ is a mesh format with a solid base. It’s got the indexed triangle sets for efficient storage of meshes and preservation of connectivity and line sets for the wireframe geometry. It supports vertex attributes — normals and texture coordinates. It can assign materials (similar to OpenGL’s fixed-pipeline materials) and a variety of textures (diffuse, bump, reflection, etc.) to the geometry.

Feature limitations

Being an older format, OBJ lacks many features that are now standard in other 3D formats: animation data (skeletons, morph targets), lights, LODs, advanced materials. OBJ doesn’t feature any built-in compression/encoding to ensure manageable file sizes on large models that are so common today.

Fig. 3. Left: structure of the original IFC model is nested, with levels representing site, building, floors, and elements on each floor. Right: model exported to OBJ lacks the nested structure; all the parts are now siblings.
Fig. 3. Left: structure of the original IFC model is nested, with levels representing site, building, floors, and elements on each floor. Right: model exported to OBJ lacks the nested structure; all the parts are now siblings.

Summary

Because of the limited scope of data OBJ is not the first recommendation, whether you’re working with CAD or 3D graphics. For CAD the biggest issue is lack of nested structure, for 3D graphics — a lack of many types of data that comes standard in other formats. In general, it’s better to first consider more feature-rich mesh formats, such as FBX, glTF, or USD. OBJ remains a good fallback option though. It can prove useful when doing software MVPs to save time on the design of data workflow.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
CAD Exchanger

CAD Exchanger

20 Followers

CAD Exchanger is a technology that enables data exchange in the multi-CAD world.