# How are obj files textured?

I am a new learner in 3d graphics. So forgive me if I seem to ask something very basic. I am confused how obj files are textured. So far I have seen:

• obj + jpg
• obj + mtl + jpg

When I look online, most say that they are textured by UV mapping. But when I look into the files, I find no specification of the UV mappings, i.e. how to map a pixel in the jpg file to a vertex (or maybe face?) in the obj file? I suppose there is some rule that is used by default. But I really need to know what it is.

Any reference, such as official documents, blogs, textbooks, online learning materials would be of great help. Thanks!

Update I came across an example here, called "texture mapped square"

# A 2 x 2 square mapped with a 1 x 1 square
# texture stretched to fit the square exactly.
mtllib master.mtl
v  0.000000 2.000000 0.000000
v  0.000000 0.000000 0.000000
v  2.000000 0.000000 0.000000
v  2.000000 2.000000 0.000000
vt 0.000000 1.000000 0.000000
vt 0.000000 0.000000 0.000000
vt 1.000000 0.000000 0.000000
vt 1.000000 1.000000 0.000000
# 4 vertices
usemtl wood
# The first number is the point,
# then the slash,
# and the second is the texture point
f 1/1 2/2 3/3 4/4
# 1 element


I assume that the coordinates following vt commands are the UV coordinates of the corresponding pixels in the texture image. Exactly what do the values mean? Are they normalized coordinates, that is, is the image normalized to have a coordinate system [0,1]x[0,1]?

Vertex positions are specified with the v command, texture coordinates with vt, and normals with vn. The faces then reference those values by index using something like f 1/2/3 4/5/6 7/8/9, where each grouping of values represents a vertex on the face, and the numbers separated by slashes are the position/texture/normal indices.
The texture coordinates are the part that tell you what point in the texture image (jpg) goes with that vertex. If you've downloaded or exported a model that has a texture mapping, you should be able to see those vt commands in the obj file.
• Thank you very much! But I still wonder what exactly do the values following the vt command mean? For example, in the updated question, the line vt 0.000000 1.000000 0.000000 refers to which point in the image? Are the coordinates of the pixels in a image normalized to be in [0,1]? I think I've also seen vt coordinates to be outside [0,1], what do those mean? Dec 3, 2020 at 6:07