Question

as far as i know, texture coordinates should range [0,1] but in this obj file as follow, the texture coordinates seem to range [0,2]

vt 2.0000 2.0000 0.0000
vt 1.7500 2.0000 0.0000
vt 1.7500 1.9750 0.0000
vt 2.0000 1.9750 0.0000
vt 1.7500 1.9500 0.0000
vt 2.0000 1.9500 0.0000
vt 1.7500 1.9250 0.0000
vt 2.0000 1.9250 0.0000
vt 1.7500 1.9000 0.0000
vt 2.0000 1.9000 0.0000
vt 1.5000 2.0000 0.0000
vt 1.5000 1.9750 0.0000
vt 1.5000 1.9500 0.0000
vt 1.5000 1.9250 0.0000
vt 1.5000 1.9000 0.0000
vt 1.2500 2.0000 0.0000
vt 1.2500 1.9750 0.0000
vt 1.2500 1.9500 0.0000
vt 1.2500 1.9250 0.0000
vt 1.2500 1.9000 0.0000
vt 1.0000 2.0000 0.0000
vt 1.0000 1.9750 0.0000
vt 1.0000 1.9500 0.0000
vt 1.0000 1.9250 0.0000

Why the texture ordinates here can be greater than 1 ? Can anybody explain it to me? Thanks!

you see the texture seems weird enter image description here

Was it helpful?

Solution

UV texture values outside [0,1] are expected to be tiled.

I've never seen this explicity stated in any of the informal OBJ specs floating about, but it mimics the behavior of OpenGL.

Here is a relevant quote from the OpenGL redbook:

You can assign texture coordinates outside the range [0,1] and have them either clamp or repeat in the texture map. With repeating textures, if you have a large plane with texture coordinates running from 0.0 to 10.0 in both directions, for example, you'll get 100 copies of the texture tiled together on the screen. During repeating, the integer part of texture coordinates is ignored, and copies of the texture map tile the surface. For most applications where the texture is to be repeated, the texels at the top of the texture should match those at the bottom, and similarly for the left and right edges.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top