Overview
Channel Packing is the practice of combining multiple grayscale images into one full color image by “packing” each grayscale image into a color channel of the resulting image. By doing this you can combine four grayscale textures into one, with one stored in the red, green, blue, and alpha channels respectively. This technique has been widely adopted as a way to cut down on the amount of textures a shader needs to sample as well as a way to save memory. To use the individual channels at runtime, the shader then splits the color image back into its respective grayscale components. It then reads the values in the image as a range from 0-255, where black represents 0 and white represents 255.
Usage
One of the most prominent examples of channel packing in Resonite is the metallic map, used by all the metallic shaders. There are two distinct metallic map packing standards used in Resonite. The first is used exclusively by the shader PBS_Metallic (the base version).
The layout for this map is as follows:
R - Metallic
G - Ambient Occlusion or Height
B - N/A
A - Smoothness
In this example three grayscale maps (metallic, ambient occlusion and smoothness) are packed together to result in the yellow-green texture. This texture can be assigned to both the occlusion map and metallic map. The occlusion map will read the information from the green channel to render ambient occlusion, and the metallic map will read the information from the red and alpha channels to generate metallic and smoothness respectively.
It is important to note that this above packing standard is only used by the base PBS_Metallic shader. All other Metallic shaders and XiexeToonMaterial use the following packing standard:
R - Metallic, Ambient Occlusion or Height
G - N/A
B - N/A
A - Smoothness