RGB/A for roughness?

Hey there,

Trying to do some optimization I wan’t to move the Roughness maps to Albedo’s alpha channel but since the Roughness maps shouldn’t be set to sRGB and Albedo itself should be set to sRGB I’m not sure if it’s the way to go. I tried putting the Roughness into Normal map’s alpha channel too but it seems to ignore the alpha while importing in engine.

Any tips would be welcome. :slight_smile:

In short I would stay away from adding masks to Alpha’s. A Texture that has an alpha will cost 2x as much as one without as alpha channels are not compressed. What I would do is make Mask Textures were each channel of the Texture has a different mask packed into it. This way you can disable gamma correction(sRGB) and not have to worry about it effect something else. This also has the added advantage being able to scale down your masks independently of your Base Color and Normal maps. Finally UE4 uses BC5 for Normals maps which gets rid of the B and A channels on import. This is why you can not use the Normal maps alpha channel as UE4 gets rid of it.

Ooo so the RGBA maps should be only used to pack masks. I didn’t know about the cost an alpha channel adds. Thanks a lot for the information. :slight_smile:

fwiw the cost of a DXT5 is the same as two DXT1s. So if you only have one mask texture, it doesn’t matter for memory consumption whether you pack it into one DXT5 via alpha or two DXT1s. You also can counteract sRGB in photoshop if you want to channel pack something. If you have multiple masks then channel packing is definitely the way to go.

Just make a level modifier and move the midpoint to value 2.2.

Nice information. I’m doing optimization work for our project these days. Thanks a lot. :slight_smile:

It’s true that DXT5(BC3) cost twice as DXT1(BC1). But the reason is not that alpha is not compressed. Alpha is compressed separately. Understanding BCn Texture Compression Formats – Nathan Reed’s coding blog

“BC3 stores RGBA data, using BC1 for the RGB part and BC4 for the alpha part, for a total block size of 16 bytes, or an average of 1 byte per pixel.”

Alpha channel at bc3_unorm_srgb is still linear. sRGB only affect RGB.

Now, I’m a little confused. Rendering Features for Mobile Games in Unreal Engine | Unreal Engine 5.1 Documentation - if the end result is the same, why go through the trouble of adding roughness to the alpha?

Reading from single texture can be bit faster than from two separate one. Also if you pack roughness to BC3 alpha channel then it’s basically BC1 + BC4 format that is superior format for single channel compared to BC1. BC4 has 8bit endpoints and 3bit indices. BC1 has 5bit red, 6bit green, 5bit blue and 2bit indices.