dxt1 with 1-bit alpha

Hi,

Is it possible to compress images to dxt1 with 1-bit alpha in the engine? If I have alpha in my image it turns to dxt5 automatically. This would be handy for textures that come with a mask in the alpha channel.

Cheers,
Pjotr

I have been wondering the same thing, and so far I can’t find any information on how to do that. If anyone could enlighten us it would be great :slight_smile:

*bump…
can anyone give us any info on this subject?

Just author the alpha mask as purely black and white to start with.

The compression algorithms for DXT1 and DXT5 are identical except for the alpha channel method, and if you create what amounts to a 1 bit alpha to start with, you’ll get nearly as good of final texture size.

Do you have some incredibly tight memory constraints you’re working in that need an explicitly 1 bit alpha?

Using DXT5 for a texture that has a 1 bit alpha is a huge waste of memory, especially if you have 50+ textures that only require 1-bit alphas.

Dxt1 is rgb soo imop you cant use dxt1 compresion if have alpha.

Yes you can, we did it all the time in our old engine. By forcing compression to DXT1, if you have an alpha channel, you’ll loose all the gradients of grays you have in your alpha and will be left with an alpha channel containing only 2 grayscale values, which is perfect for something like a metallic map for example, or any type of mask where you only need 2 grayscale values, and you save a ton of memory that way.

You can’t use DXT1 1-bit alpha like that. That 1-bit alpha does not have separate bit per pixel for alpha channel but it’s has special encoding that makes whole color fully black.(r=0,g=0,b=0,a=0). This work for unfiltered alpha cutouts but not independent channels like metalness. It’s also lower quality of color part. Normally there is two endpoints with two values between. When special 1-bit alpha mode is used you only have one value between those endpoints.
Still it would be good to have it.

Hi Jenny,
could you elaborate a little more on why 1-bit alpha can’t be use for a metalness mask? Most metallic masks only need pure black and pure white values, so why wouldn’t a mask stored in the alpha channel with only those 2 values wouldn’t work for metalness? We didn’t have PBR in our old game engine, so we used 1-bit alpha for masking color modulation areas, or for foliage probability masks. Now I understand that a 1-bit alpha wouldn’t work for a roughness mask for example, since it needs more then 2 grayscale values, but I would think a metallic mask would be the perfect candidate for that (only if you want either pure metal and pure non-metal).

Thanks!

What Jenny is getting at is not that a one bit alpha texture wouldn’t work for a metalness map, but that the alpha information isn’t stored separately from the color data in DXT1 compression. Its essentially a premultiplied alpha, where the color value of those pixels are set to a “transparent black” setting, which winds up discarding the color information in those pixels also.

Just use DXT5. If you’re super concerned about texture memory usage then pack your alphas into a separate RGB texture and use them per channel.

Yeah. Non metal parts would be pure black. Not very useful. For Metalness mask we use Compression mode Alpha(BC4) and this texture is usually a lot smaller resolution. But currently there is iOS metal bug that prevents any usage of Compression mode Alpha.

Got it, thanks for the info guys!

Bumping this thread again. A better use case (opposed to metalness mask) is for Opacity Mask values in foliage, chain-link, etc. Packing your opacity mask into the diffuse makes perfect sense and costs half as much memory as a dxt5, it’s also a free texture read if you don’t want to introduce a new packed texture.

You can’t use that neither for foliage opacity mask nor for metalness mask, or any other mask effectively, simply because if you did, you would not be able to maintain cutout silhouette in lower mips decently.
It is quite niche,compression method, suitable for special case usage, not a generally required thing.

There are few cases, where it shines, but it is definitely not applicable to foliage mask nowdays.

That’s quite interesting. Why would a masked silhouette derived from an 8-bit alpha (black or white, no gradients except for maybe minimal anti-aliasing) be different from the one derived from a 1-bit alpha? Even if mipped?

Is there a way to force BC1 in Unreal, if just to test it? I downloaded Intel’s Texture Works plugin for Photoshop, which allows saving DDS, but its BC1 has no alpha.

Thank you in advance.

Edit: if I understand correctly, some black outline/bleed on the edges might be an issue, because the transparent pixels color gets discarded. But other than that, what is the issue? Thanks.