SoFunction
Updated on 2025-03-09

Introduction to obj format

There are two types of *.obj files we often see: the first is an OBJ file (also known as the target file) based on the COFF (Common Object File Format) format, which is used to compile applications; the second is an OBJ model file launched by Alias|Wavefront. The OBJ file format I want to talk about refers to the second type - OBJ model file. <BR> When it comes to 3D file formats, everyone will definitely not be unfamiliar with them, "*.3ds", "*.max", "*.lw", "*.mb", "*.dxf", "*.obj", I believe everyone can list several types. However, when it comes to the specific characteristics of OBJ files, few people can give a relatively satisfactory description. Many people know that OBJ files start with using Poser. Poser is a human body modeling software. To export the human body generated by Poser to other 3D software for reprocessing, OBJ files are used. OBJ files are a standard 3D model file format, which is very suitable for mutual derivation between 3D software models. For example, if you build a model in 3dsMax or LightWave and want to adjust it to Maya to render or animation, exporting OBJ files is a good choice. Currently, almost all well-known 3D software supports reading and writing of OBJ files, but many software need to use plug-ins to do this.
In addition, as an excellent file format, many game engines also support the reading of OBJ files. What is the use of understanding the OBJ file format? If you don't learn programming, it's really useless. However, mutual derivation between 3D software models is a very common thing. Unfortunately, the current 3D software model export function is not so perfect, and there are often missing faces and lines, and sometimes there are situations where the exported model cannot be opened at all. If the situation is very urgent, you will definitely study it carefully at all costs, hoping to find the cause and solve the problem. In this case, my tutorial may be of great help to you
OBJ files are a text file format, which means you can directly open them with the WordPad for viewing and modification. If you can understand what the content of each line means, I believe that it is not far from your successful solution to the problem.
OBJ Files is a file format developed by Wavefront for its 3D modeling and animation software "Advanced Visualizer" based on workstations.
The new version of OBJ is v3.0, replacing the previous version of v2.11.
The OBJ3.0 format supports polygons, lines, surfaces, and free-form curves.
Lines and polygons are described by their points, while curves and surfaces are defined based on additional information that is attached to their control points and to the type of curve. This information supports regular and irregular curves, including those based on Bezier curves, B-splines, Cardinal/Catmull-Rom splines, and Taylor equations.
OBJ Files-- Features
(1) OBJ is a 3D model file, so it does not contain information such as animation, material characteristics, map path, dynamics, particles, etc.
(2) OBJ files mainly support polygons (Polygons) models.
(3) OBJ files support more than three points of face.
(4) OBJ files support normals and map coordinates.
OBJ files do not support polygonal faces with holes.
The OBJ file does not contain color definition information for the face, but you can refer to the material library. The material library information is stored in an independent file with the suffix ".mtl". The keyword "mtllib" means the material library. The material library contains the definition values ​​of diffuse, environment, and gloss. After "usemtl" specifies the material, this material will be used in the future until the next "usemtl" is encountered to specify the new material.
OBJ file -- Basic structure
An OBJ file consists of lines of text, with comment lines starting with a "well" sign (#). Spaces and blank lines can be added to the file at will to increase the readability of the file. Lines with words start with one or two marker letters, that is, keywords. Keywords can explain what kind of data this line is. Multiple lines can be logically concatenated together to represent a line by adding a connector (\) at the end of each line.
Note that there cannot be spaces or tabs after the connector (\), otherwise it will cause file errors.
The following keywords can be used in OBJ files.
In this list, keywords are arranged according to the data type, and each keyword has a short description.
Vertex data:
v Geometric vertices
vt Map Coordinate Points (Texture vertices)
vn Vertex normals (Vertex normals)
vp parameter space vertices (Parameter space vertices)
Free-form curve/surface attributes:
deg degree (Degree)
bmat Basic matrix (Basis matrix)
step step step size (Step size)
cstype Curve or surface type                                                                                                                                                                                                                                                      �
Elements:
p Point (Point)
l line (Line)
f face (Face)
curv curve (Curve)
curv2 2D curve (2D curve)
Surf surf (Surface)
Free-form curve/surface body statements:
parm parameter value (Parameter values)
trim external trimming loop (Outer trimming loop)
hole Internal renovation loop (Inner trimming loop)
scrv special curve
sp Special point (Special point)
end end statement (End statement)
Connectivity between free-form surfaces:
con Connect (Connect)
-Grouping:
g group name (Group name)
s Smoothing group (Smoothing group)
mg Merging group
o Object name (Object name)
-Display/render attributes:
bevel directional angle interpolation (Bevel interpolation)
c_interp Color interpolation
d_interp Dissolve interpolation (Dissolve interpolation)
lod Level of detail (Level of detail)
usemtl Material name (Material name)
mtllib material library (Material library)
shadow_obj Casting shadow (Shadow casting)
trace_obj ray tracing (Ray tracing)
ctech curve approximation technology (Curve approximation technology)
stech surface approximation technology (Surface approximation technology)