Introduction
OBJ is a plain text format for 3D geometry, created by Wavefront Technologies for its Advanced Visualizer software. It lists vertex positions, texture coordinates and normals, then builds polygons from them. Because it is simple and readable, almost every 3D program can import and export it.
Materials live in a separate material library file (.mtl) that the OBJ
file names. The extension .obj is also used for compiled object files
made by Windows compilers, which are a different format entirely.
Structure
An OBJ file is a list of lines, each starting with a keyword. v gives a
vertex position, vt a texture coordinate and vn a normal.
f makes a face from vertex numbers, counted from 1 in the order the
vertices appear, each optionally followed by its texture coordinate and normal
numbers as v/vt/vn. Negative numbers count back from the latest vertex.
o and g name objects and groups, mtllib names
the material library, usemtl picks a material for the faces that follow,
and # starts a comment.
# a single textured square
mtllib square.mtl
o Square
v 0 0 0
v 1 0 0
v 1 1 0
v 0 1 0
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vn 0 0 1
usemtl Paint
f 1/1/1 2/2/1 3/3/1 4/4/1
Also used for
- COFF object file .obj
- OMF object file .obj
- Object files (OMF and COFF) .obj
Links
Software
- Blender (Windows, macOS, Linux)
- Autodesk Maya (Windows, macOS, Linux)
- Autodesk 3ds Max (Windows)
- Cinema 4D (Windows, macOS)
- MeshLab (Windows, macOS, Linux)
- Unity (Windows, macOS, Linux)
- Godot (Windows, macOS, Linux)
Developers
- tinyobjloader, C++ library that reads OBJ and MTL files
- trimesh, Python library that loads and saves OBJ among other mesh formats
- Assimp, C++ library that imports dozens of 3D formats, OBJ among them
- three.js, JavaScript, with its OBJLoader and MTLLoader
Reference
- Object files (.obj), Paul Bourke’s copy of the Wavefront specification