Home Technical Talk

Rectangular texture maps, a bad thing?

polycounter lvl 12
Offline / Send Message
Will Faucher polycounter lvl 12
Hey,
I've noticed alot of people use rectangular texture maps for some props (Ex. 2048x1024). I was always told to avoid this at all costs. But logically, it would only use half the power of a full 2048x2048 right? It would waste much less texture space depending on the shape of your UV unwrap.

Is it bad to make it rectangular? Or it is encouraged if it can save texture memory?

Replies

  • PredatorGSR
    Options
    Offline / Send Message
    PredatorGSR polycounter lvl 14
    Rectangles aren't any more expensive as far as I know. It allows you to get a more precise texel density. For example, 512x512, 512x1024, 1024x1024, it allows you to double the texture size instead of quadrupling ever step. As long as it is laid out correctly, it isn't any different. Especially for long uv shells, it allows you to create better uv layouts so that you waste less space.
  • Will Faucher
    Options
    Offline / Send Message
    Will Faucher polycounter lvl 12
    That's what I thought. But I was told that it took more time for the computer to calculate a rectangle as opposed to a square. Which is why it was supposedly better to stick with Square maps.
    Thanks!
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    UV coordinates always range from 0.0 - 1.0 they are not described in sizes such as 512 x 256 but always 0.0 - 1.0 because they are described as floating values within that range (although you can place stuff outside, but usually when textured it gets looped).

    So whenever you create a UV map of lets say 512 x 256 in the end you will get a more or less square UV with coordinates ranging from 0.0 - 1.0 regardless of the aspect ratio. I am not a math person but from what I know or guess is that many methods used in the texture mapping to project UV to view coordinates are based on triangle math and square fixed or related things. I guess in the end it comes down to some kind of math or formula that just works best or assumes that U and V have the same size or a linear proportion.

    I found for example that some methods in 3dsMax UVunwrap editor go off with non square proportional UV maps, which is why many people suggest to first map out everything in a square and then simply crop the UV canvas to the final size.

    Some engines on the other hand or frameworks merge textures together in bigger texture atlas to optimize drawing calls and reducing memory footprint in runtime. It's usually artists that can't think in those ways and need for every particular object a separate texture whereas in the end in many engines it would be more efficient to have it in 1 or a few textures combined.
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    Where I work, I've been told that it doesn't matter that the texture is square, so much as that the dimensions are "square", as in Power of 2. So, 512x512 is alright, 512x256 is alright, but 512 x 400 is bad. Not being a "square number" is the big issue.

    Another thing we run into is that, for some shaders, all textures in the pipeline have to use the same dimensions for the math to work correctly. So if everything you're using is 512x256, that's fine, but if you have a 512x256 diffuse and a 512x512 normal map, it'll cause problems. This one I can't really explain, as what renderhjs said is totally correct; the engine just sees 0.0-1.0 texture space, and that 512x256 texture is converted to a percentage anyways. But, that's what they tell me.
  • Ghostscape
    Options
    Offline / Send Message
    Ghostscape polycounter lvl 13
    I use rectangular textures on most of the stuff I do, we don't need a full 1024x1024, and a 512x512 doesn't quite do it, so the rectangle is great. half the cost of the square, memory-wise. I am not a programmer but I cannot believe that any calculation cost involved in using a rectangle is ever going to come close to affecting anything significantly. I'd say if you're in a place where saving memory isn't as important as shaving whatever miniscule nano-cycle that calculation might possibly cost, you have bigger concerns.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    yeah on new platform it should be ok.
    But for example, iPhone will convert a 512x1024 to a 1024x1024 automatically.
    Some very old graphical card also do that.
Sign In or Register to comment.