Game Development Reference
In-Depth Information
f 3/1 4/2 5/3
#Vertex/Texture Mapping/Normal information
f 6/4/1 3/5/3 7/6/5
#Vertex//Normal
f 6//1 3//3 7//5
In the preceding file, the key concept to understand is the three data elements, v , vn ,
and vt :
v : This refers to the vertex indices of an object.
vn : This refers to the vertex normal information.
vt : This holds the texture information. We will not use this data element
now. It will be discussed in Chapter 4 , Applying Textures .
The important element is f , faces. A face in an OBJ file defines the properties of each
polygon. It has indices of the vertices/normals/textures defined in the preceding
file. In the preceding example, a face has three vertices as we had selected the option
Triangulate Faces while exporting the file. If we exported without triangulation, we
would have had four vertices per face.
The relation between v , vn , and vt in f is shown in the following table:
Cases
Description
Case 1: f 1 2 12
The element f holds only the vertex information of the face.
Case 2: f 2/2 3/5 4/5
The pair maps the vertices to texture coordinates; the
second vertex maps to the second texture coordinate.
Case 3: f 2/2/2 3/2/
4 3/3/4
The value 2/2/2 would mean the second vertex is
mapped to the second texture coordinate in the vt
array and the second element is the normal index in the
normal array vn .
Case 4: f 2//2 3//4 3//4 The value 2//2 would mean the second vertex is mapped
to the second normal in the v and vn data elements.
Understanding the material file format (MTL)
Open the exported MTL file in your favorite text editor. The following is the code of
an MTL file; the inline comments are added to build a better understanding:
# Blender MTL File: 'None'
# Material Count: 1
#Material name definition
newmtl [MaterialName]
#Specifies the specular exponent for the current material. This
defines the focus of the specular highlight.
Ns 96.078431
Search WWH ::




Custom Search