PDA

View Full Version : texture atlas should I bother?



ugluk
11-16-2010, 10:26 AM
When should I use texture atlases? Do any games at all use them? Whenever I used them, I've had problems with bleeding from neighboring texels.

Dark Photon
11-16-2010, 10:58 AM
Suggest texture arrays instead. No bleeding, no texcoord math, and still no need to swap textures.

Alfonse Reinheart
11-16-2010, 02:02 PM
When should I use texture atlases?

The only reason to do so is to cut down on texture binds. So before bothering, you should find out if that's going to help your application's performance.

mhagain
11-16-2010, 02:53 PM
The other reason to use them is to increase batch sizes (which - in fairness - is a consequence that should fall out of reducing texture binds) which will certainly help performance in any non-trivial case. They're also useful if you're stuck with non-power-of-2 2D GUI textures and you need to run on hardware that doesn't have non-power-of-2 texture support.

Yes, games do use them. Any game that has it's character set in a texture is most likely using a texture atlas to draw characters.

ugluk
11-16-2010, 04:07 PM
mhagain, I don't count the character textures. There are no problems with texel bleeding there. It's just a texture for the unwrapped character mesh. What if I made a texture atlas from a couple of character textures and got bleeding between a couple of them? It almost always happens in unpredictable ways (at least to me). Is leaving blanks between regions of the texture atlas going to solve this?

mhagain
11-16-2010, 04:56 PM
Leaving blanks (set to r0 g0 b0 a0) and setting the proper blend mode (or using alpha testing) is one way, yes. Another one that's probably only appropriate to unscaled GUI textures is to use a GL_NEAREST filter mode. Another one is to duplicate the outer edges of each sub-texture in the atlas by 1 texel.

ZbuffeR
11-17-2010, 12:05 AM
try at least 2 extra texels.