Object Files (.obj)

文件格式


以#号开始的为注释行。

An OBJ file contains several types of definitions:


Face definitions

面片的定义使用顶点坐标、贴图坐标和法向量坐标的索引。

Faces are defined using lists of vertex, texture and normal indices. Polygons such as quadrilaterals can be defined by using more than three vertex/texture/normal indices.

OBJ files also support free form curved surface objects such as NURB surfaces.

There are several ways to define a face, but each face line definition starts with "f" character.


Vertex

A valid vertex index starts from 1 and match first vertex element of vertex list previously defined. Each face can contain more than three elements.

表示这个面片由顶点列表中的第v1个顶点、第v2个顶点、第v3个顶点和第v4个顶点连接而成。

索引值从1开始。(也可以取负值,表示从最后一个顶点开始数上去。)

Vertex/texture-coordinate

Each texture coordinate index must follow with no space the first slash. Texture coordinates index are optional. A valid texture coordinate index starts from 1 and match first texture coordinate element of texture coordinate list previously defined. Each face can contain more than three elements.

Vertex/texture-coordinate/normal

Each normal index must follow with no space the second slash. Normals index are optional. A valid normal index starts from 1 and match first normal element of normal list previously defined. Each face can contain more than three elements.

Vertex/normal

As texture coordinates are optional, one can define geometry without them, but one must put the normal index after second slash.


References:

http://en.wikipedia.org/wiki/Wavefront_.obj_file

http://people.sc.fsu.edu/~jburkardt/txt/obj_format.txt

http://www.cppblog.com/lovedday/archive/2008/06/13/53153.html

http://mailao.ycool.com/post.1905836.html

posted on 2011-01-11 12:48  哈呜  阅读(265)  评论(0编辑  收藏  举报

导航