Up Jvx Format Byu Format Obj Format Poly Format

Data Formats

Wavefront and Java3D .obj Format

The Wavefront .obj file format is a standard 3D object file format created for use with Wavefront's Advanced VisualizerÖ and available for purchase from Viewpoint DataLabs, as well as other 3D model companies. Object Files are text based files supporting both polygonal and free-form geometry (curves and surfaces). The Java 3D .obj file loader supports a subset of the file format, but it is enough to load almost all commonly available Object Files. Free-form geometry is not supported.

The following text is close to the description of the .obj file format in the Sun Java3D documentation.

The Object File tokens currently supported by the JavaView loader are listed below. Unknown tokens are skipped without affecting the reading process.

# some text
Line is a comment until the end of the line
v float float float
A single vertex's geometric position in space. The first vertex listed in the file has index 1, and subsequent vertices are numbered sequentially.
vn float float float
A normal. The first normal in the file is index 1, and subsequent normals are numbered sequentially.
vt float float
A texture coordinate. The first texture coordinate in the file is index 1, and subsequent textures are numbered sequentially.
f int int int ...
or
f int/int int/int int/int . . .
or
f int/int/int int/int/int int/int/int ...
A polygonal face. The numbers are indexes into the arrays of vertex positions, texture coordinates, and normals respectively. A number may be omitted if, for example, texture coordinates are not being defined in the model.
There is no maximum number of vertices that a single polygon may contain. The .obj file specification says that each face must be flat and convex. In JavaView polygonal face may be triangulated.

The example file sample.obj is given below (it is a cube):

v 1 1 1
v 1 1 -1
v 1 -1 1
v 1 -1 -1
v -1 1 1
v -1 1 -1
v -1 -1 1
v -1 -1 -1
f 1 3 4 2
f 5 7 8 6
f 1 5 6 2
f 3 7 8 4
f 1 5 7 3
f 2 6 8 4