Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm having trouble visualizing this geometrically - why is it that multiplying the U,V coordinates of a texture coordinate has the effect of scaling that texture by that factor?

eg if you scaled the texture coordinates by a factor of 3 ..then doesn't this mean that if you had texture coordinates 0,1 and 0,2 ...you'd be sampling 0,3 and 0,6 in the U,V texture space of 0..1? How does that make it bigger

eg HLSL: tex2D(textureSampler, TexCoords*3)

Integers make it smaller, decimals make it bigger

I mean I understand intuitively if you added to the U,V coordinates, as that is simply an offset into the sampling range, but what's the case with multiplication?

I have a feeling when someone explains this to me I'm going to be feeling mighty stupid

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

A quad with the texture coordinates 0,0 on the one corner and 2,2 on the other corner, means the texture is tiled 4 times, 2 times in each direction.

Now if you have the same quad with 4,4 on the other corner instead you have the texture tiled 16 times, 4 times in each direction.

If you increase the texture coordinates without increasing the size of the quad you are drawing a larger portion of the texture on the same surface, thus making the texture itself look smaller. For drawing a 200x200 texture on a 100x100 quad you need to scale it down, for drawing a 50x50 texture on a 100x100 quad you need to scale it up.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.