I've seen tilesets of the game Braid, and for each tileset in the main folder there is an alpha map for it in "alpha" folder.

I wonder, why just not to draw your image as it is (with transparent parts where you want), export to PNG format and parse it to RGBA texture?

Why would one use a separate alpha map for this, is there some kind of performance benefit?

  • \$\begingroup\$ What format braid uses for textures? \$\endgroup\$ Mar 19, 2016 at 14:26
  • \$\begingroup\$ probably not possible due to copyright but I really would like to take a look at the files \$\endgroup\$ Mar 19, 2016 at 15:54
  • \$\begingroup\$ Benedikt, yes you cannot use these images in game or share with someone, but you can look in game folder and find package.zip:) Inside it there is "pieces" folder. \$\endgroup\$
    – MrKnyaz
    Mar 19, 2016 at 18:50
  • \$\begingroup\$ HolyBlackCat, it uses jpeg format. \$\endgroup\$
    – MrKnyaz
    Mar 19, 2016 at 19:03

3 Answers 3


The idea of using a separate transparency map is a bit of a throwback to an earlier era, where we would use black-and-white bitmaps as transparency masks to draw sprites.

That said, it's still a perfectly viable technique today. There's really no appreciable performance difference between using a color and alpha map versus one color map containing alpha as an additional color component. There may be some minor issues regarding disk or memory footprint, but those will mostly be irrelevant in the grand scheme of things.

A good reason to use separate image sources like this today is not for game runtime performance but authoring performance. If you only have tools available to you that don't work well with images containing alpha channels, or you simply prefer to work this way, it can be more efficient for you to do so rather than in a context where the alpha is embedded into the color.

Similarly if you've chosen a particular image format that doesn't support embedded alpha channels for other important reasons, you may end up using this "separate mask image" technique.


Sometimes RGBA compresses worse than RGB and A separately.

Also it is known technique to use JPG for resources, where game could sacrifice some picture quality in favor of smaller size (e.g. backgrounds). Standard JPG does not support Alphas, so resource has to be split into two - RGB + A. Note that also allows for different compression ratios. E.g. some RGBs is more forgiving to higher compression ratio artifacts.

*as well noted in comments, JPG allows for different formats and even user-defined chunks that can include anything, yet majority of loaders will provide for just common JFIF / RGB data.

  • 1
    \$\begingroup\$ This is an excellent point that I tend to forget. \$\endgroup\$
    – user1430
    Mar 19, 2016 at 16:07
  • 1
    \$\begingroup\$ Thank you for your answer. I think background is a very good place to use this technique. \$\endgroup\$
    – MrKnyaz
    Mar 19, 2016 at 19:00
  • 1
    \$\begingroup\$ "JPEG does not support alphas" - Java has no problem reading and writing JPEGs with alpha, but most other programs won't read them correctly. I don't know whether it's using a non-standard extension, or a standard extension that's just not widely supported. \$\endgroup\$
    – user253751
    Mar 19, 2016 at 22:10
  • 2
    \$\begingroup\$ @immibis JPEG supports an arbitrary number of components, but doesn't define what they are. JFIF, the most common format JPEG compression is used with, says there can only be 1 or 3 components, either grey scale or Y/Cr/Cb. Most JPEG decoders only know how to handle JFIF files. \$\endgroup\$
    – Ross Ridge
    Mar 20, 2016 at 0:31
  • \$\begingroup\$ Isn't it kinda pointless since any images loaded into graphics card memory become bitmaps and take up the same memory space for the same resolution as any other image format, compressed or not? I don't think hard drive space matters as much as video ram today. Correct me if I'm wrong. \$\endgroup\$ Mar 20, 2016 at 8:39

There is one really good reason for using alpha masks. A bunch of tilesets need an alpha mask variant to not look boring.

Say you have a tileset consisting of grass and dirt. In this example grass is the bottom layer and dirt is the top layer. You can easily blend the border between these, but it would look straight and dull. You could also create some algorithm that tries to do something pretty for you, but can become cumbersome and most likely performance costly.

Instead, enter "Alpha masks"! define e.g. 64 masks that create "variant" blending. Could be top-bottom, a hole inside the top layer, where you want grass to pop out from(or reverse) and so on.

An easy way to do this is to add an extra set to texture coordinates as vertex attributes in your shader and then blend based on the mask contained within those texture coordinates.

There are a ton of ways of doing this, Alpha masking is just one solution. The big PRO with alpha masking is using it in conjunction with texture atlases/sprite sheets, it can yield huge performance benefits! The big CON is that texture atlases are way harder to implement compared with precomputing a bunch of texture variants and then just using a texture array.

As a side note. If you are going to use texture atlases for tiling, you might want to read up on precomputed mipmaps.

  • 1
    \$\begingroup\$ Thanks you for your answer, I know that alpha masks can be used to do pretty stuff. But the question was why they used them if the only thing they needed was just alpha channel. \$\endgroup\$
    – MrKnyaz
    Feb 25, 2020 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .