Hi,
I've been reading a bit on
channel packaging today.
I'd like to know what you guys think, which methods you prefer or if you have anything to add or correct to what I've gathered so far. Hopefully this also helps some peeps that didn't know about the little details regarding channel packaging.
In the UE4 Docs there's this bit of info:
Masking and Channel Artifacts
Because of a quirk with DirectX, the Green Channel of a texture will often offer the best compression. If any of your masks suffer greatly from compression artifacts, first try placing the information into the Green Channel to see if that helps. If that does not fix the issue, then try using the Alpha channel to store the information.
* Be careful when trying to use the Alpha channel of a texture to store Mask Textures. Adding an Alpha channel to a texture will greatly increase the memory footprint of that texture and if you do this enough, you could lose all the saving you gained by packing different Mask Textures in to the RGB channels of a textures.
The quote above kinda suggests the Roughness should be in the Green channel, as roughness is the texture where we want to preserve as much detail as possible. Not to mention Metal tends to be black and white, with almost no fine details. However I see that the most accepted method of packing mask is RMA (R = Roughness, G = Metalness, B = AO).
Wouldn't MRA be best, with Roughness in the green channel and Metalness in the Red one, or would the difference be negligible?
And when is it worthwhile to use the alpha channel if it has such an impact on memory? Maybe for more important assets like characters?
I've also seen some artists come up with their own packaging schemes, going as far as packaging roughness in the blue channel of a BC7 normal map (if I understood correctly).
I've also read that channel packaging reduces memory but at the cost of increasing draw calls. Is this something an artist should be concerned about?
To end the post I'll just add some extra pointers for those of you who didn't know:
- As mentioned in the quote above, generally it's a good idea to avoid the alpha channel as it greatly increases the use of memory which defeats the purpose of channel packaging.
- Channel packed textures needs to be stored in linear space (in UE4 you need to open the texture and untick the sRGB checkbox) or they won't look correctly in the engine.
Replies
Also, packing is reducing calls as you're only using 1 texture node as opposed to 2 or 3.
This is why choosing dxt1 or dxt5 for packing can sometimes balance out calls vs memory footprint.
This is my understanding anyway. I'm no tech artist. Hopefully @obscura or somebody will chime in.
I wouldn't call this a quirk, its expected behavior the green channel has one extra bit as the channels of DXT1 are compressed at R5G6B5 which fits into a 16 bit color format. Therefore ideally your most important map is packed into the green channel, in most cases this is roughness/gloss. That being said I highly doubt you will notice a difference.
Here are some thoughts on alpha channel and texture packing - http://polycount.com/discussion/182251/questions-about-materials-shaders-and-textures. Some engines pack normal and roughness together so they can apply Toksvig filtering without depending on finding the other texture on disk.Some maps are authored in sRGB. (Specular and roughness/gloss maps are often authored in sRGB) I don't know for sure but I would find it hard to believe that AO maps are baked in linear - but maybe I'm wrong. Its fairly simple to independently apply gamma correction to a single channel in a shader.
In reality BC7 can double your texture footprint when compared to DXT. Its pretty tough to justify channel packing like this when the texture is twice the size. BC5 normal maps compressed at R8G8 can look better at half or even quarter res than a DXT normal map. So there can be some savings there.
As for the green channel, even if it's not nearly noticeable, when it comes to either performance or image quality every little bit helps so I'd definitely be willing to use MRA packaging from now own, since roughness detail is more crucial to the material than the other masks.
Regarding sRGB vs linear, in my experience Specular maps (in spec workflow) and Albedo/BaseColor are sRGB, but Normal maps & masks like Roughness/Gloss/Metalness/AO aren't, Opacity being an exception for instance saved in the BaseColor alpha, therefore in sRGB. That's just how I've always made and tested them, though so not sure if it can change depending on the project/engine.
I definitely to agree on BC5 for normals maps, in my opinion it's very much worth the quality bump over other formats and like you said it even allows for smaller textures when needed at similar definition.
Regarding draw calls vs textures, that's something i'd like to hear more about and maybe test personally.