OBJ is a geometry description file format developed by Wavefront Technologies for their Advanced Visualizer animation package. The file format is open and has been adopted by other developers of 3D graphics applications. It can be exported / imported to e-Frontier's Poser , Maya , XSI , Blender , MeshLab , Misfit Model 3D , 3D Studio Max and Rhinoceros 3D , Hexagon , CATIA , Newtek Lightwave , Art of Illusion , milkshape 3d, Modo , Cinema 4D , Zanoza Modeller , LIRA PC , Mineways , etc. For the most part, this is a common format.
| Obj geometry format | |
|---|---|
| Expansion | |
| MIME type | |
| Developer | |
| Format type | 3D model format |
The OBJ file format is a simple data format that contains only 3D geometry, namely, the position of each vertex, the relationship of the texture coordinates with the vertex, the normal for each vertex, and also the parameters that create the polygons.
Content
File Format
Lines starting with a pound (#) are comments.
# This is a comment
The obj file contains several types of definitions:
# A list of vertices with coordinates (x, y, z [, w]), w is optional and defaults to 1.0.
v 0.123 0.234 0.345 1.0
v ...
...
# Texture coordinates (u, v [, w]), w is optional and defaults to 0.
# The texture coordinate in y can be specified as 1 - v, and at the same time in x = u
vt 0.500 -1.352 [0.234]
vt ...
...
# Normal (x, y, z); normals may not be normalized .
.
vn 0.707 0.000 0.707
vn ...
...
# Parameters of vertices in space (u [, v] [, w]); free form of geometric state (see below)
vp 0.310000 3.210000 2.100000
vp ...
...
# Definitions of the surface (sides) (see below)
f 1 2 3
f 3/1 4/2 5/3
f 6/4/1 3/5/3 7/6/5
f 6 // 1 3 // 3 7 // 5
f ...
...
# Group
g Group1
...
# An object
o Object1
Defining Parties
A surface is defined in a list of vertices, texture coordinates, and normals. Polygons such as a square can be defined using more than 3 vertices / texture coordinates / normals.
Peaks
The line starting with f is the index of the Surface. Each surface (polygon) may consist of three or more vertices.
f v1 v2 v3 v4 ...
Indexing starts from the first element, and not from zero, as is customary in some programming languages, and indexing can also be negative. A negative index indicates the position relative to the last element (index -1 indicates the last element).
Vertices / Texture Coordinates
Along with vertices, corresponding texture coordinate indices can be stored.
f v1 / vt1 v2 / vt2 v3 / vt3 v4 / vt4 ...
Vertices / Texture Coordinates / Normals
Saving the corresponding normal indices is also acceptable.
f v1 / vt1 / vn1 v2 / vt2 / vn2 v3 / vt3 / vn3 v4 / vt4 / vn4 ...
Peaks // Normals
In the absence of data on texture coordinates, a record with a skip of texture indices is acceptable.
f v1 // vn1 v2 // vn2 v3 // vn3 v4 // vn4 ...
Material Library
| MTL material format | |
|---|---|
| Expansion | . mtl |
| MIME type | |
| Developer | Wavefront technologies |
| Format type | 3D texture format |
Overview
OBJ is one of the most popular 3D transmission geometry formats. Information about the appearance of objects (materials) is transmitted in satellite files in the MTL format (Material Library). OBJ, if necessary, refers to such a file using the directive:
mtllib [name of external MTL file]
Introduction
MTL is a standard established by Wavefront Technologies. All information is presented in ASCII form and is absolutely readable to humans. The MTL standard is also very popular and is supported by most packages for working with 3D graphics.
Information about simple materials in the file is as follows:
newmtl material_name1 # Declare another material # Colors Ka 1.000 1.000 0.000 # Ambient light color (yellow) Kd 1.000 1.000 1.000 # Diffuse color (white) # Reflection options Ks 0.000 0.000 0.000 # Mirror reflection color (0; 0; 0 - off) Ns 10.000 # Mirror reflection coefficient (0 to 1000) # Transparency options d 0.9 # Transparency is specified using the d directive Tr 0.9 # or in other format implementations using Tr # Next material newmtl material_name2 ...
All parameters are optional. In the absence of any parameter, the program automatically sets it by default.