Best size for textures?

BlitzMax Forums/MiniB3D Module/Best size for textures?

ima747(Posted 2009) [#1]
I'm sure it's application specific, but what is generally the best way to create textures for a level? Is it better to try to wrap everything in as few huge textures as possible, or is it better to use numerous smaller textures?

For example. If I make a level that's a bedroom. Is it better to use 1 texture for the bed, 1 for the desk, 1 for the walls and 1 for the dresser. Or is it better to use 1 much larger texture with everything rendered on it?

I was trying to read up on how openGL deals with textures but I found a lot of conflicting information regarding optomizing. Some say more smaller textures is better because they can be moved in and out of memory faster as needed, others say larger textures are better because they don't need to be moved as much.


Sledge(Posted 2009) [#2]
It's more platform specific, I'd venture. If we're talking about the iPhone then baking everything (ie both texture and lighting info) onto one UV-mapped 'skin' for each discrete template of level geometry (ie a corridor piece or room shell... anything relatively complex that you might instance numerously) is definitely worthwhile. (In Unity parlance it's a matter of keeping your draw-calls to a minimum; in Blitz it's keeping your surface count low.) Given the size of the screen and its resolution, this can be done fairly inconspicuously.

On desktop you're probably going to want to atlas* the textures -- ie make them all part of one big texture sheet and map the UV's accordingly -- but leave the lighting to a second set of UV's or, if your target platform is sufficiently high, leave it to whatever real-time process you favour. This way your individual texture info wont be squeezed onto one big 'skin' and graphical fidelity can be preserved.


In general, though, exceeding vram and causing textures to be swapped about strikes me as flat-out undesirable. The nice thing about UV's is that you can load in a lower-res version of the texture and they still apply. It's probably worth considering maintaining a few lower-res copies of your textures for gfx cards with less memory -- it's not like they're difficult to produce once you have the master.


*I think that's the term!