Obj (Wavefront) File Format

This is a file format used for storing 3 dimensional meshes for modeling objects.

This is a text file containing lines which conform to one of the following formats:

type first character remainder of line
comment # any text
start new group g groupName
start new object o objectName
vertex v coordinates of a vertex
texture coordinates vt coordinates (each 0 to 1) of where in the texture map
vertex normal vn  
face f Each point's info is V/T/N where
V = number of vertex in vertex coord list,
T = number of vertex in vertex texture info list,
N = number of vertex in vertex normal list.
smooth s name or 'off'
use mtl file usemtl  

There are other line types, for instance curves, especially in newer versions of the standard. However most applications stick to the following types

Examples of Lines from .obj File

#example obj file
v -1.63326156 -3.04798102 -8.81131839
vn 0.00379090 0.40057179 0.01256634
vt 0.22390614 0.97395277
g shield1
f 4/2/4 3/1/3 2/2/2

Vertex

Each vertex is put on a separate line like this:

v -1.63326156 -3.04798102 -8.81131839

The first such line in a file is vertex index 1, the next such line is index 2 and so on. Note indexes start at '1' not '0' as do arrays in most computer languages.

The possibly floating point numbers represent the x,y and z coordinates of the vertex.

Texture coordinates

Texture coordinates are optional, if used, each texture coordinates is put on a separate line like this:

vt 0.22390614 0.97395277

They are indexed in the same way as the vertices.

The two numbers represent the u,v coordinates each between 0 and 1. Representing the coordinate of the vertex on the texture

Vertex normal

vn x y z: vertex normal list: vector pointing at 90deg to
where you want smoothing to put the surface to at that
vertex.

Face

A face may be a triangle, quad or polygon. The 'f' is followed by the indices of the vertices (corners) of that face like this:

f 4/2/4 3/1/3 2/2/2

Group and Object

When the 'group' or 'object' name is encountered in the file it will apply to all the subsequent faces until it is changed again.

Some programs such as poser allow two names following the 'g' or 'o' the first is the group and the second is the material.

I'm not sure the distinction between groups and objects in this context, many users tend to use both.

Further Information

Importing .obj files into Blender is described on this page.

Use of .obj files in Poser and DAZ Studio is described on this page.

External site with further information here

and Wikipedia


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.