costum texture size

Started by
4 comments, last by smasherprog 12 years, 8 months ago
Hi,
I'm wondering if i use like a texture with size 1024 x 2048
How do i sample it and what are the uv coordinates.

Ty
Advertisement
The UV are always 0-1. 512,1024 would be .5,.5
Ty for the reply.
So i have this panoramic sky texture that is 4096 x 1024.
If i want to texture it my uv coordinates are between 0 - 0.5 is that what u mean?

Ty for the reply.
So i have this panoramic sky texture that is 4096 x 1024.
If i want to texture it my uv coordinates are between 0 - 0.5 is that what u mean?

[s]It would be 0-1 in the x/u direction and 0-0.25 in the y/v direction.[/s] Edit: sorry, drunk when I posted that :D
It would be 0-1 in the x/u direction and 0-1 in the y/v direction.

However, some graphics cards might not allow non-square textures, or might allow them but store them as a square texture anyway (so your texture would be a 4096 x 4096 with only the top 1024 pixels actually used) so a safer alternative would be to make it 2048 x 2048 with the left half of the original texture in the top 1024 and the right half in the bottom 1024.

Ty for the reply.
So i have this panoramic sky texture that is 4096 x 1024.
If i want to texture it my uv coordinates are between 0 - 0.5 is that what u mean?


UV coordinates are affine, meaning they're unitless and as such are independent from texture resolution. For most purposes, like, say, texturing a mesh, this means you can freely change the global level of detail for the texture and things work out. Loosely, it'd be like the low-resolution texture gets 'stretched out' to cover the high-resolution one (and as an aside, this behavior is a requirement for MIPmapping to work properly)
If you're trying to sample from *specific pixels* in the texture, that changes things-- can you clarify what it is you're trying to do with your texture here?
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
Another way to describe uv coordinate is to say that they are percentages. Meaning 1.0 = 100% and 0 = 0%. So, if you have a u coord of .4, it means it samples the tetxture 40% away from the point (0, 0) in the u direction (which is left-to-right, the v direction is up-down). In Direct x (0, 0) is the top left corner of the image, in open gl it is the bottom left corner of the image.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

This topic is closed to new replies.

Advertisement