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]?