Greyscale versus Masked channels compression issue!


I’m trying to optimize my game by putting all of my greyscale textures into one texture using the RGB channels of that texture.
The problem is that the result is totally different from the separate greyscale textures when I replace them with the Masked one.

Below you can see the first picture showing the greyscale texture and the one underneath showing the RGB channels one.


Red channel

If anyone knows what causes this issue I would greatly appreciate.

Long answer: Understanding BCn Texture Compression Formats – Nathan Reed’s coding blog

Short answer: Color texture compression does not treat channels as individually but clump them together as 4x4 block with two color endpoints and each pixel has 2bit indice to linerly interpolate from those colors. This cause cross channel bleeding.

I would suggest you to use separate Alpha compression(BC4) textures for each mask. This reduces bandwith to half.

Make sure you change the actual texture compression type to the correct one; within the texture. I’m pretty sure that IT has to match what you’re looking for. I’m not 100% sure about this, but my guess is that whatever the actual texture is set to is then being sampled, by the material, and is getting converted to a different sampler type. So it’s almost like saving something as a jpg and then trying to save it as a png. Also, sometimes the material editor is real weird with gamut.



I would also add that you might want to put your most important mask into the Green channel, as usually that is the highest quality channel.

Thanks for the reply.

I have changed the compression to Masks already as you can see in the lower screen shot, it says masked but it still shows the compression issue sadly.

Thanks, I will try it out.

No, you’re doing that from within the material editor; which isn’t what I’m talking about(I can tell from the yellow undo arrow next to it). As far as I know, it’s just resampling something that has already been resampled. For example: If the version in the texture editor were set to BC1, you drag/dropped that into the material and then you set the material sampler type to BC4, the real texture would be compressed into BC1 and from that BC1, you’d now make the BC4. Now like I said, I could be entirely wrong about this, but I’m pretty sure that this is how it works. If someone has intimate knowledge of this process, please correct me if I’m wrong.

Change the textures within the actual texture editor and drop that into the material. And yes, green channel is usually the least compressed out of the bunch because our eyes see differences in it strongly.

EDIT: Oh and speaking of the green channel stuff, make sure that sRGB is turned off in the texture as well.

Using green channel gives you 6-bit instead of 5-bit for endpoints. But this does not help with cross channel talk at all. Texture sampler does nothing for texture compression it’s just guide UE4 how that texture should be sampled. There are no different sampler for different compressions.

For best quality and most freedom to choose size per mask don’t try to pack channels that does not depend on each others. Try to test this: One fullsize Masks vs three half size Alpha texture. Alpha textures would save you 25% memory and give you cleaner quality.