Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Wavefront OBJ

From ReverseEngineering.wiki
Format
Magic none (text)
Extensions .obj, .mtl
On this wiki Facts · Code · Notes · Topics

Wavefront OBJ (.obj) text mesh format and its MTL material library (.mtl): line-based records v, vt, vn, f, g, o, usemtl and mtllib.

Identification

OBJ has no magic number; it is a text file of line records. Assimp's parser (code/AssetLib/Obj/ObjFileParser.cpp, lines 168-270) dispatches on the first character of each line:

  • v x y z: vertex. With 4 components it is homogeneous; with 6 components the last 3 are a vertex colour (lines 172-190).
  • vt: texture coordinate (2D or 3D), vn: normal.
  • f, l, p: face, line, point.
  • g: group, o: object name, s: smoothing group.
  • usemtl NAME: select material; mtllib FILE: name the material library, which is a separate .mtl file (lines 218-250); mg is a merging group.
  • #: comment.

The MTL file is also text; the .obj refers to it by file name, so both must be kept together when extracting a game or tool asset.

Unverified: face indices are 1-based and may be negative (relative); v/vt/vn index triplets. Assimp's code suggests relative indices (line 519 comment "Store relatively index") but that was not read in context.

Tools and sources

assimp (BSD-3-Clause): https://github.com/assimp/assimp

Code & repositories

  • https://github.com/assimp/assimp @ f20e46b3fc1fdf9bc2675fd549d180dda06861f1 · license: BSD-3-Clause (declared by the contributor for the files used; GitHub reports BSD-3-Clause (read from LICENSE; GitHub's detector did not classify it) for the repository)
    Open Asset Import Library; importers in code/AssetLib read as format documentation
    Tested on: source read, not run: source read only · checked 2026-10-19; last activity 2026-10-17; Note: the latest release ships binaries; the wiki links only the source, never the binaries

See also

Format:STL, Format:PLY, Format:COLLADA