Tuesday, February 3, 2009

Maya Obj file format

The .obj file format supports both polygonal objects and free-form objects. Polygonal geometry uses points, lines, and faces to define objects while free-form geometry uses curves and surfaces.

File structure: (syntax)

Vertex data:

geometry vertices (v x y z / v x y z w)

texture vertices (vt u / vt u v / vt u v w)

vertex normals (vn i j k)

parameter space vertices (vp u / vp u v / vp u v w)

Free-form curve/surface attributes

rational or no-rational forms of curve or surface type: basis matrix, Bezier, B-spline, Cardinal, Taylor (cstype)

degree (deg)

basis matrix (bmat)

step size (step)

Elements

point (p)

line (l)

face (f)

curve (curv)

2D curve (curv2)

surface (surf)

Free-form curve/surface body statements

parameter values (parm)

outer trimming loop (trim)

inner trimming loop (hole)

special curve (scrv)

special point (sp)

end statement (end)

Connectivity between free-form surfaces

connect (con)

Grouping

group name (g)

smoothing group (s)

merging group (mg)

object name (o)

Display/render attributes

bevel interpolation (bevel)

color interpolation (c_interp)

dissolve interpolation (d_interp)

level of detail (lod)

material name (usemtl)

material library (mtllib)

shadow casting (shadow_obj)

ray tracing (trace_obj)

curve approximation technique (ctech)

surface approximation technique (stech)

A typical .obj file:

image

 

Referencing groups of vertices

Some elements, such as faces and surfaces, may have a triple of numbers that reference vertex data. These numbers are the reference numbers for a geometric vertex, a texture vertex, and a vertex normal.

Each triplet of numbers specifies a geometric vertex, texture vertex, and vertex normal. The reference numbers must be in order and must be separated by slashes (/).

The first reference number is the geometric vertex.

The second reference number is the texture vertex. It follows the first slash.

The third reference number is the vertex normal. It follows the second slash.

A four-sided face element:

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

f v/vt/vn v/vt/vn v/vt/vn v/vt/vn

 

Much more details can be found here: Download

No comments:

Post a Comment

Google+