首页 > 其他 > 详细

Computer Graphics Thinking–texture tiling

时间:2014-03-14 18:09:11      阅读:384      评论:0      收藏:0      [点我收藏+]

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.

Computer Graphics Thinking–texture tiling,布布扣,bubuko.com

Computer Graphics Thinking–texture tiling

原文:http://www.cnblogs.com/kenden23/p/3599495.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!