简体   繁体   中英

What's the Meaning of Texture Coordinate in obj Files

So here's the question: what do the values of texture coordinates represent? For example, in my obj file, texture coordinates look like these:

vt 0.474178 0.050139
vt 0.477308 0.050139
vt 0.480438 0.050139
vt 0.483568 0.050139

The size of my texture (bmp file) is 640*360. Does that mean (0.474178, 0.050139) in the obj file correspond to the (0.474178*640, 0.050139*360) point in the bmp file? That is, texture coordinates indicate the point position in bmp file by doing:

 u*width_of_the_bmp,  v*height_of_the_bmp

And if I'm wrong, how can I get the corresponding correlation between vt and bmp point position? Because I want to get the RGB values for every vertex, and I can get the RGB values for every pixel in the bmp file, how to link these data together to get what I want?

That is correct.

Usually , texture coordinate 0,0 is pixel coordinate 0,0, and texture coordinate 1,1 is the opposite corner. Texture coordinates greater than 1 wrap around the texture, so if you go from 0,0 to 2,0, you go around the texture twice.

Of course, some programs might interpret them differently. There's no rule that it must be this way, but it usually is the case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM