Channel Packing: Difference between revisions

From Resonite Wiki
Zandario (talk | contribs)
Minor joke
 
Full rewrite of the Channel Packing article with added demonstration graphics
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
In many Materials within Resonite, a process/technique called Channel Packing is used. Channel Packing is a way of using the color data within images to represent information which Resonite Materials can use. Each Pixel within these images is used as a value for a particular part of a Material.
== 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.


For example in this image:
== Usage ==
[[File:BlackWhiteGradient.jpg]]
[[File:Channel Packing Graphic.png|alt=An image labled Metallic Map Channel Pack. There are four boxes on the left, each containing a grayscale image intended to be packed into one of the four color channels. They are labeled red, green, blue and alpha. They are connected by lines to a combined image where the four are combined into one image that is a combination of the four grayscale layers. Underneath the composite image is the following text Red - Metallic, Green - Ambient Occlusion or Height, B - Nothing, Alpha - Smoothness. In the bottom right this graphic is signed "Graphics by GreaterKibah"|thumb|Individual components of a metallic map]]
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 Black parts could represent a value of 0 and the white parts represent a value of 1.
The layout for this map is as follows:


TODO: I'm working on this over the next few days - Prime
R - Metallic


TODO: Apparently not! - <small>[[User:Zandario]] 2 years later</small>
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.
[[File:Metallic channel packing demonstration.jpg|alt=A screenshot of Resonite with a partially filled out PBS_Metallic shader in an inspector. A packed metallic map has been assigned to the occlusion and metallic map slots, and the material reflects these changes.|thumb|In game demonstration of a packed map being used for both the occlusion map and metallic map|center]]
 
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

Latest revision as of 02:21, 16 January 2024

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

An image labled Metallic Map Channel Pack. There are four boxes on the left, each containing a grayscale image intended to be packed into one of the four color channels. They are labeled red, green, blue and alpha. They are connected by lines to a combined image where the four are combined into one image that is a combination of the four grayscale layers. Underneath the composite image is the following text Red - Metallic, Green - Ambient Occlusion or Height, B - Nothing, Alpha - Smoothness. In the bottom right this graphic is signed "Graphics by GreaterKibah"
Individual components of a metallic map

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.

A screenshot of Resonite with a partially filled out PBS_Metallic shader in an inspector. A packed metallic map has been assigned to the occlusion and metallic map slots, and the material reflects these changes.
In game demonstration of a packed map being used for both the occlusion map and metallic map

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