Computer Graphics Thinking–texture tiling

Here is one question: how to tile texture?

One thing worth to notice: The DirectX and OpenGL stipulate that a texture source(normally a picture)’s texture coordinate is fixed as [0,1], which mean that it’s smallest x and y coordinate is 0, and largest coordinate is 1.

If that’s the situation, how can we tile a texture source?

Can we do it this way?

1 we shrink the texture coordinate

2 and then ma texture to our triangles

Actually, we do it in the opposite way:

1 we enlarge the texture coordinate

2 and then map texture to our triangles

Why?

The key is :

As we mention before, the texture is fixated in range [0,1], and the texture coordinate is map to the whole triangles(like the triangles comprised as a height map), if the texture source was shrinked, like to 0.3, than mean we get [0,0.3] of the texture source map to the whole triangles, which will get the effect as enlarging the texture source.

So we have to do it the oppsite way. For example, if we enlarge the texture to 5 times, we get [0, 5] of the texture source map to the whole triangles, just like we get a whole texture resource map to [0,1], and then if we warp up the texture, we get another same texture map to [2, 3], [3,4],[4,5],  so we get the final effect that we tile our texture to our triangles 5 times.

That’s a very confused concept for rookies in computer graphics.

你可能感兴趣的:(graphics)