Textures and RGB channels in Unreal Engine 4

This is an obsolete article that was written without any structure. At the moment, I have posted a series of tutorials on the topic of texturing, which covers as much as possible all aspects of texturing. Read here .

The article is saved as a story.

RGB and Unreal Engine


General concepts of RGB channels


RGB (often RGBA ) is an abbreviation of Red-Green-Blue (Alpha) . Which means 3 channels of colors, the mixing of which leads to the transfer of the desired color shade (If Alpha is used, then the degree of transparency of this or that element is indicated).

Each channel consists of values ​​from 0 to 255. These values ​​are the channel level. The higher the level, the stronger the color in the channel. Each pixel of the texture (of any image and your monitor) is displayed in RGB format - that is, each channel has 3 color channels at the same time - each with its own level.

If we see a red pixel, then the channels green and blue have a level equal to 0.
If green, then red and blue are equal to 0.
If blue, then red and green are equal to 0.

Below the picture, only the red channel is active, the rest have values ​​equal to zero:

image

It is worth noting that in the Unreal Engine 4 engine, the color values ​​are not from 0-255, but from 0 to 1. Actually, this is done for programming convenience, but in fact the channel levels still have values ​​from 0 to 255, only presented within 0-1, where 0 = 0, and 1 = 255. In this case, if sRGB is turned off, then the usual linear mapping is used, where the value 0.5 is equal to 128.

Unreal Engine 4 is able to work with all channels simultaneously (full color gamut transmission ) and with each channel separately.

The picture below shows how the color node looks in the engine:

image

This node does not contain color. This is a set of 4 values ​​- RGBA channels, which are written as floating-point numbers from 0 to 1 each. And you can set your own value in each channel and give it out. Color is just the total sum of these values ​​in one pixel.

The first pin from the node is the sum of the three channels - RGB.

The second, third and fourth pins are the outputs of each channel, respectively.

The fifth pin is the fourth channel or Alpha channel . According to the idea and general idea, this channel is used to control transparency - what should be transparent, what should not be transparent, and what should be translucent.

In fact, alpha-channel (as a transparency channel) does not exist. This is still the same set of numbers from 0 to 1, so this channel can be replaced freely with any other channel that will provide the desired transparency levels (value levels from 0 to 1 in the desired pixels).
However. It is worth remembering that the Alpha channel takes up space equal to all three RGB channels . And the cost of processing it increases by 2 times compared with the processing of any of the RGB channels separately.

Oftop. In general, this node is a vector - a container containing 4 values.

Using channels in Unreal Engine 4


Typically, Unreal Engine 4 uses a texture of type TARGA. It allows you to work with each channel separately.

In PBR * there are such cards as AO, Metallic, Roughness, Specullar and Emissive (There are a lot of options, but this is enough for us). All these cards use only values ​​from 0 to 1 (black and white cards). That is, the 1st channel with values ​​from 0 to 1 is enough for the engine to calculate these cards.

For example, Metallic can be either 0 or 1 (either metal or not metal). Accordingly, a pixel can have a value of 1 ( white color in a visual representation) or 0 ( black color in a visual representation).

For example, there is such a texture. The following picture is displayed in the RGB channel (all three channels together):

image

If you look at each channel separately, you can see how the textures change - one channel is responsible for Roughness, the second for Specular, the third for AO, the fourth for alpha.

image
image
image
image

The last picture also displays the color scale in Adobe Photoshop, in which you can not specify any other color than the white gradient (from 0 to 255) when editing in any one channel (in the picture, editing occurs on the Alpha channel).

Accordingly, the texture can now be used to connect to Unreal Engine 4 materialimmediately in three (or 4) parameters. The alpha channel does not have to be used for transparency - it can also be used as any other texture where you want to specify values ​​from 0 to 1 within the same channel.

* PBR - PHYSICALLY BASED RENDERING . Physically correct render (physics based render). Texture mapping system according to the physical behavior of real light.

Also popular now: