Why are 32-bit textures too bright + exhibit alpha artifacts?

PROBLEM DESCRIPTION

32-bit textures are too bright and exhibit alpha artifacts when used in translucent materials whereas a 24-bit + an 8-bit texture look correct (see the attached screenshots). What am I doing wrong?

HOW TO REPLICATE THE PROBLEM

  1. Download AlphaTest.zip via this link: Cahoots — Ann Arbor tech coworking

  2. Load AlphaTestLevel.umap

  3. Observe the difference between the two sprites, and compare the two materials.

  4. The material with the 32-bit texture exhibits alpha artifacts and is brighter than the material with the 24 + 8-bit textures.

ADDITIONAL NOTES

  • PNG textures with transparency are affected the same way as 32-bit textures.
  • Turning sRGB off in the texture settings only seems to make the 24+8-bit textures brighter (despite the fact that the tooltip says that it should be turned off when using “alpha channels individually as masks”).
  • The texture sample type in the 24+8-bit material needs to be set to ‘Color’ as opposed to ‘Linear Color’ in order to look correct.


23311-

Hi!

In first - all 3 images is a 8-bit images. Or 8-bit per channel. 32-bit is a float format or 32-bit per channel. In “32-bit” you have 24-bit or 3 channel for RGB and 8-bit or 1 channel for alpha. In UE4 applied gamma to all channel, and you seeing wrong mask, because gamma applied to alpha too. In “24+8-bit” in real, you have “24+24-bit” and you have RGB color and visual corrected with prebaked gamma RGB image for mask. It is not big deal. If you want use your “32-bit” image, you can correct alpha inside material, just add Power node.

But I recommended use 2 files - RGB for color and Grayscale for mask. You mask file is “RGB - 3 channel” image, not Grayscale - 1 Channel" image. You need open it in photoshop and convert from RGB to Grayscale and save. This better, because compressing 2 files, RGB and Grayscale, give less artifacts, then compressed 1 file “RGB+Alpha”.

Hi svv3dUDN,

Thanks a lot for the reply - that explains pretty much everything!

You’re right to point out that my use of the expression “24-bit” + “8-bit” textures is a bit sloppy, sorry about that :slight_smile:

I wasn’t talking about the number of bits per channel - what I meant to refer to was how the two textures were used, i.e. the “24-bit” texture was used for the RGB channels and the “8-bit” texture was used as an 8 bits/pixel opacity mask in the material (even though both texture files of course have 3 channels, each with 8 bits = 24 bits/pixel).

In any case, thanks for establishing the reason for the brightness problem - that was very helpful!

QUESTION 1:

Apart from adding the Power expression to the shader, is there no other way to prevent UE from automatically applying Gamma to the alpha channel of a “32 bits/pixel” texture?

It seems odd to me that what you see in the texture editor preview in UE is not what you get in the game editor when you use “32 bits/pixel” textures.

What I’m getting at here is that I would ideally want to use a single (uncompressed) 32-bit TGA (or even a PNG) texture for those of my textures that require opacity masking.

The reason is that I have 663 high resolution 2D PNG textures that will be offered as an asset pack on the Marketplace. I want to supply the textures in the original resolution and in a lossless format (either compressed TGA or PNG), so the users can scale down the textures to whichever resolution they need. I guess the easiest option would be to supply my TGA/PNG textures with a material that includes the Power expression, along with documentation that explains why it is required.

QUESTION 2:

If the answer to question 1 is no, does it add extra overhead in terms of performance loss & increased memory consumption to use two separate textures instead of a single 32-bit TGA or PNG texture in UE?

Thanks in advance for your reply - I will mark this thread as resolved as soon as you reply again! :slight_smile:

Store color and mask-opacity-alpha in one file it is a bad idea. It is not work acceptable in default. You workflow named “24+8-bit” with two files, is normal practice.