CSCI 441 - Computer Graphics

Fall 2024 - .obj File Format

.obj File Format

Sample *.obj file:
#
# example .obj file
#

mtllib cube.mtl

v -1.0 -1.0 -1.0
v -1.0 1.0 -1.0
v 1.0 1.0 -1.0
v 1.0 -1.0 -1.0
v 1.0 -1.0 -1.0
v 1.0 1.0 -1.0
v -1.0 1.0 -1.0
v -1.0 -1.0 -1.0
# 8 vertices

vt 0.0 0.0
vt 0.0 1.0
vt 1.0 1.0
vt 1.0 0.0
# 4 vertex tex coords

vn 0.0 0.0 1.0
vn 0.0 0.0 -1.0
vn -1.0 0.0 0.0
vn 1.0 0.0 0.0
vn 0.0 1.0 0.0
vn 0.0 -1.0 0.0
# 6 vertex normals

s 1
usemtl cube_mtl
f 4/4/1 3/3/1 2/2/1 1/1/1
f 8/4/2 7/3/2 6/2/2 5/1/2
f 1/4/3 2/3/3 7/2/3 8/1/3
f 5/4/4 6/3/4 3/2/4 4/1/4
f 3/4/5 6/3/5 7/2/5 2/1/5
f 5/4/6 4/3/6 1/2/6 8/1/6
# 8 faces
Explaination of each line: For more information, visit Wikipedia or paulbourke.net.