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.
A file of either extension dropped on any page of this site opens in the explorer, which shows the model from several sides, a wireframe, every statement tied to its bytes, and any problems it finds. Nothing is uploaded: the file is read in your browser.
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
Beyond polygons the format can describe points, lines, and free-form curves and
surfaces. An .mtl file is written the same way, with a
newmtl statement starting each material.
A worked example
This three-vertex triangle is a whole model. It is 32 bytes of ASCII, one statement
to a line, and every line ends with a line feed (0A). Files written on
Windows end each line with 0D 0A instead, and some old Mac files use
0D alone; readers accept all three.
v 0 0 0
v 1 0 0
v 0 1 0
f 1 2 3
00000000 76 20 30 20 30 20 30 0A 76 20 31 20 30 20 30 0A v 0 0 0.v 1 0 0.
00000010 76 20 30 20 31 20 30 0A 66 20 31 20 32 20 33 0A v 0 1 0.f 1 2 3.
76 is “v”, 66
is “f”, 20 a space and 30, 31, 32
and 33 the digits 0 to 3.The first three lines add vertices 1, 2 and 3. The fourth builds a face from them, counterclockwise as seen from the front. The explorer shows this file as a triangle from four sides, as a wireframe, and as a tree of four statements, each tied to its bytes.
Quirks
- There is no header, signature or version number. A file is OBJ because its statements are, which is how the explorer tells it from compiled object code that shares the extension.
- The specification defines no units and no axes. Y up is common, but exporters differ, and a model may arrive on its side or at a thousand times the size.
- The texture coordinate
vcounts from the bottom of the image, while most image formats store the top row first, so loaders usually flip it. - A face with more than three corners is a polygon, and not always flat or convex; a reader has to split it into triangles. The explorer uses a fan from the first corner and reports polygons that are not flat.
- Vertex numbers go on counting across
oandglines. A negative number is relative to the line it is on, so moving a statement changes its meaning. - Material names and file names are matched as written. A
mtllibmay name a file with a Windows path, spaces, or a DOS-shortened name, and a model moved from one machine to another often loses its.mtland textures. - Some programs add vertex colours after the coordinates (
v x y z r g b), which the specification does not have. - The material library and the texture images are never inside the
.obj. Even a copy of a model made without them still opens, in a plain colour.
In the explorer
Drop an .obj on the page and the explorer shows the model in an interactive
3D view (drag to orbit, right-drag to pan, wheel to zoom, a walking camera, wireframe,
normals, material colours and textures, and a click selects the statement a face or
vertex came from in the tree and the hex view), four still views and a wireframe in a
Pictures tab, the object and group tree, the statement counts, the objects, group names,
smoothing groups and materials with the faces in each, the libraries named by
mtllib, and every problem it found, each tied to its line.
Because a browser gives the page only the file it is handed, the explorer cannot
see the .mtl or the textures beside it, and gives each material a
stand-in colour. To see the real colours and textures, drop or choose the
whole folder and open the .obj from the folder’s list: the
explorer then reads the .mtl and the images in that folder and in the
folders below it, to two levels, and paints the faces with each material’s diffuse colour
(Kd), its d or Tr opacity, and its
map_Kd texture. PNG, JPEG, TGA, BMP and PPM textures are read, with the
-s, -o and -clamp options and data:
addresses; a texture of another kind, or one that is not in the folder, is listed in
the materials table with the reason. Nothing is uploaded.
Not drawn: lighting from Ka, Ks, Ke,
Ns and the illumination model, the bump, reflection and PBR maps (they
are listed), vertex normals (faces are lit flat), and the free-form types and
trimming described on the curves page.
In this reference
- Lines and syntax – statements, comments, numbers, continuation, and the general statements
- Vertices –
v,vt,vnandvp, and how they are numbered - Elements – faces, lines and points, with every corner form
- Curves and surfaces – free-form curves, surfaces and their body statements
- Groups and objects –
g,s,mgando - Display attributes – materials, texture maps and how shapes are drawn
- MTL materials – the
.mtlstatements, colours and illumination models - MTL texture maps – map statements and their options
Not described
The Wavefront specification is public and well supported by open readers, so most of the gaps below are work not yet done, not mysteries. Both ratings stay partial. The text follows Paul Bourke’s copy of the specification, read in an earlier session and not re-read, and the viewer was tried in Node only (53 distinct real files from one machine, 44 OBJ and 9 MTL, plus built files), not in a browser.
Known, not yet covered
- Reference: re-read in full on 2026-11-18 (Paul Bourke’s copies of appendix B1, the .obj file, and of the .mtl chapter): the basis-matrix element order (column index fastest), the Taylor and basis-matrix parameter rules and that
fois no longer valid from version 2.11 (still read, written back asf) agree with these pages. The specification mentions ascmpstatement (“scmp filename.pv $1”, supplying a .pv file to the files called after it) and an appendix C on variable substitution that Bourke’s copy does not include, soscmpis not described here. The equations of the free-form maths are missing from the text copy. The binary.modform is not described. See curves. - Reference: the physically based
.mtlstatements and vertex colours after the coordinates: documented by the Clara.io proposal, Blender and tinyobjloader, not the specification; described here from common practice. See MTL. - Reference: where programs look for the
.mtland textures: shown by three.js MTLLoader and tinyobjloader, not written up. - Viewer: Cardinal, Taylor and basis-matrix curves and surfaces, trimming loops, holes, special curves and connections, all in the specification. They are counted and checked and not drawn.
- Viewer: lighting from
Ka,Ks,Ke,Nsandillum, and the bump, reflection, displacement and physically based maps. They are listed in the tree and not applied; faces are lit flat, so normals and smoothing groups do not change the pictures. - Viewer: textures other than
map_Kd(ormap_Ka), and image types other than PNG, JPEG, TGA, BMP and PPM: named in the materials table with the reason, not drawn. Drawing is checked on built files only. - Viewer: the
.mtland images are found only when the model is opened from a dropped folder (two levels deep). A single file, or an.objinside a zip, gets stand-in colours. - Viewer:
callandcshare never run, and files they,shadow_objortrace_objname are not read. UTF-16 text is turned down.
Unknown
- Reference and viewer: the binary
.modform, the procedural texture files (.mpc,.mps,.mpb,.cx*) and spectral.rflfiles: no public layout was found. The viewer reads neither and names them in the materials table. - Reference and viewer: other vendor statements: no source lists them. The viewer reports them as not part of the format and shows them as text.
- Reference and viewer: how real texture images are used: no real texture file was found on the machine used, so it rests on built files.
Also used for
- Anonymous object header – The wrapper Microsoft’s compiler writes for link-time code generation.
- COFF object file – Compiled code from Windows compilers, waiting for the linker.
- COFF object file (bigobj) – The extended form of COFF, for objects with very many sections.
- OMF object file – Intel’s object format for 16-bit DOS and Windows compilers, in typed records.
- Object files (OMF and COFF) – Two object file formats share .obj on DOS and Windows: OMF and COFF.
Links
Software
- Blender – free open source 3D suite that imports and exports OBJ (Windows, macOS, Linux)
- Autodesk Maya – modelling and animation program for film and games (Windows, macOS, Linux)
- Autodesk 3ds Max – modelling, animation and rendering program (Windows)
- Cinema 4D – Maxon’s modelling and motion graphics program (Windows, macOS)
- MeshLab – free open source mesh viewer and editor (Windows, macOS, Linux)
- Unity – game engine that imports OBJ models (Windows, macOS, Linux)
- Godot – free open source game engine that imports OBJ models (Windows, macOS, Linux)
Developers
- tinyobjloader – small library that reads OBJ and MTL files (C++)
- trimesh – mesh library that loads and saves OBJ among other formats (Python)
- Assimp – library that imports dozens of 3D formats, OBJ among them (C++)
- three.js – 3D library for the web, with its OBJLoader and MTLLoader (JavaScript)
Reference
- Object files (.obj) – Paul Bourke’s copy of the Wavefront specification
- MTL material format – Paul Bourke’s copy of the material library specification