Is it possible to use all 4 channels (RGBA) in texture mask?

In the UE4 texture mask example Using Texture Masks in Unreal Engine | Unreal Engine 5.2 Documentation, the alpha channel is unused.

I’d like to get more than 3 values, so i thought I could use the Alpha channel in addition to RGB. Each channel (RGBA) has different (non-overlapping) white parts which correspond to different colors on the base texture.

As soon as I try to add the alpha channel in with the other 3, the RGB channels all lose their specific Roughness and Metallic values.

Each channel is just fed into a lerp alpha (with B being set to max roughness, i.e. .2, .3, .7, .8), and all the lerps are added together before being plugged into Roughness.

Hey,

You can absolutely use the Alpha channel alongside the RGB for packed textures. Best method is to pack them in photoshop or any good image program, and ensure you export as a 32bit targa. In photoshop just add new channel and it will add a alpha channel to your RGB document.

In Unreal, have ‘use SRBG’ disabled in the texture editor. Also double check at the top it says has alpha channel : true. You can preview each channel with the channel dropdown on the top left of the texture editor viewport.

1 Like

Hey DanielOrchard. Thanks a lot for the help.
I’m using Krita.
Each channel (rgba) has a specific part in white, and the rest black.
I set the bit depth to 32.

I exported it as tga, but I couldn’t find any settings to export it as 32bit tga.
After importing into UE4 I removed the check from “Use SRGB”.

The channels, and bit depth details, look like in Krita:

For some reason still, adding the alpha causes all the other channels to lose their roughness.
I can email you the texture if you need it. Or do you have a texture mask texture that’s properly set up so I can look at it?

Update: The image editor I was using didn’t properly export the targa as 32 bit.

yes, you can use all 4 texture channels. but please keep in mind, that using only 3 channels allows to compress texture into DXT1-format, while additional alpha will force you to compress tex into DXT5-format, which is twice bigger in size.
for instance, you have tex 512x512. In DXT1 it will take ~170 Kb, while in DXT5 it will consume ~340 Kb.

1 Like

thank you very much for the simple explanation. So, if I remove the alpha from one texture, making it use DXT1, and then move that alpha to either RG or B in a different texture, it seems to use a little less space than having kept it in the alpha channel on the original texture.

As a test I found that having white in 3 channels was 1.75kb while 1 channel was 1.29kb (about 80% of the original size). Do you know of any documentation that describes the benefits of using the Alpha vs just creating 2 separate DXT1 textures.

Also I was wondering if it’s possible to get 6 different roughness values (3 from each texture mask texture) working on 1 material.

Before Exporting you need to fix your “Roughness layer Levels” before Channel Packing the Texture:

  1. Select your Roughness Layer/Select, “Filter” in your Menu Tab/Select “Adjust”/Select “Levels”/Under, “Input Levels”/Set 0 to “127”.
  2. will fix the Roughness in your Channel Packing.

Good Luck!

1 Like