Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems about texture coordinate in Obj format

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

like image 732
yvetterowe Avatar asked Oct 16 '11 03:10

yvetterowe


People also ask

Can an OBJ file have textures?

As such, OBJs can encode the surface geometry of a 3D model but can also store color and texture information. The format does not store any scene information (such as light position) or animations, however.

How do you assign coordinates to texture?

Computing Appropriate Texture Coordinates The texture coordinates of the texture square are (0, 0), (1, 0), (1, 1), and (0, 1) in counterclockwise order. When you're drawing the wall, just give those four coordinate sets as the texture coordinates as you specify the wall's vertices in counterclockwise order.

What does texture coordinate do?

Texture coordinates define how an image (or portion of an image) gets mapped to a geometry. A texture coordinate is associated with each vertex on the geometry, and it indicates what point within the texture image should be mapped to that vertex.

What is the process of creating texture coordinates called?

Unwrapping is the process of assigning texture coordinates to the faces of a mesh. A texture coordinate is a 2 point value, typically called a UV Value, that indicates the position of a particular face's vertex on a texture.


1 Answers

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.

like image 88
nsanders Avatar answered Sep 26 '22 23:09

nsanders