Home Technical Talk

Seprate Texture For Alphas?

polycounter lvl 11
Offline / Send Message
jocose polycounter lvl 11
I thought I remember a thread about this made awhile ago but I can't find it. Do any of you have any opinions or rules of thumb regarding when to use a separate texture for your alpha images. I often times see 512x512 or 1024x1024 textures with only a small fraction of the image used for an alpha texture.

Is this bad in any way, would it make more sense to make a separate image for the alpha, or does the potential for an extra draw call screw things up. (I'm thinking mostly for UDK and nex gen engines here not old school)

Replies

  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Do you mean this thread? Compression talk happens around 10-11 posts down.
  • Eric Chadwick
    Options
    Offline / Send Message
    Generally better to store the alpha in the same texture as another map, this reduces texture fetches (basically the process of loading another texture into memory).

    But it's also generally better to use a different shader for the transparent parts of a model, than for the non-transparent bits. This reduces the fill rate cost (basically the process of drawing the screen). The same texture can still be used in both shaders, so you still reduce fetches.

    Hoping to get more on the wiki about this at some point.
  • Jonathan
    Options
    Offline / Send Message
    First of all, you'll want to consider what platform(s) it's going to be/would be used on.

    Secondly, perhaps think of it this way and consider where your bottleneck is.

    A 512x512 as a DXT1 (8:1 compression) is about 170kb.

    Now, if you need to store an opacity map in the alpha channel of your texture, normally, the choice is DXT5 (i.e.-interpolated alpha) or the hardly-ever-used DXT3 (implicit alpha, only useful for really noisy opacity maps, and again, hardly ever useful).

    If you're using DXT5, that "170kb" texture is now 341kb. Or for another example a 1024x1024 texture is 682kb @ DXT1, but if you store an opacity map via DXT5, that's now around 1.33mb!

    Now, there is a "free" option, and that is DXT1 with a one bit alpha. It's low precision, and often causes artifacts, especially with MIPs so it's normally not the first option to use (the artifacts are due to that you're borrowing bits of information from the main RGB channels, and therefore losing some precision of your main texture).

    So I guess, maybe if it's a small texture you should store it in the alpha channel, however, if it's a huge texture (1k, 2k, or greater), consider storing it in a separate, smaller texture. Sure, you'll decrease the performance of that asset, but if it's within budget, you'll be good to go.
Sign In or Register to comment.