Filename extension | .obj |
---|---|
Internet media type | text/plain |
Developed by | Wavefront Technologies |
Type of format | 3D model format |
Filename extension | .mtl |
---|---|
Developed by | Wavefront Technologies |
Type of format | 3D texture format |
OBJ (or .OBJ) is a geometry definition file format first developed by Wavefront Technologies for its Advanced Visualizer animation package. The file format is open and has been adopted by other 3D graphics application vendors.
The OBJ file format is a simple data-format that represents 3D geometry alone — namely, the position of each vertex, the UV position of each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of vertices, and texture vertices. Vertices are stored in a counter-clockwise order by default, making explicit declaration of face normals unnecessary. OBJ coordinates have no units, but OBJ files can contain scale information in a human readable comment line.
Lines beginning with a hash character (#) are comments.
An OBJ file may contain vertex data, free-form curve/surface attributes, elements, free-form curve/surface body statements, connectivity between free-form surfaces, grouping and display/render attribute information. The most common elements are geometric vertices, texture coordinates, vertex normals and polygonal faces:
A vertex can be specified in a line starting with the letter "v". That is followed by (x,y,z[,w]) coordinates. W is optional and defaults to 1.0. Some applications support vertex colors, by putting red, green and blue values after x y and z. The color values range from 0 to 1.
A free-form geometry statement can be specified in a line starting with the string "vp". Define points in parameter space of a curve or surface. "u" only is required for curve points, "u" and "v" for surface points and control points of non-rational trimming curves, and "u", "v" and "w" (weight) for control points of rational trimming curves.
Faces are defined using lists of vertex, texture and normal indices. Polygons such as quadrilaterals can be defined by using more than three vertex/texture/normal indices.
OBJ files also support free-form geometry which use curves and surfaces to define objects, such as NURBS surfaces.
A valid vertex index matches the corresponding vertex elements of a previously defined vertex list. If an index is positive then it refers to the offset in that vertex list, starting at 1. If an index is negative then it relatively refers to the end of the vertex list, -1 referring to the last element.
Each face can contain three or more vertices.