Shaders

RED4 shaders (mt)

What are shaders?

Every visual asset in REDengine uses a specific shader, designated by REDengine as MT (.mt) files. Even meshes "without a shader" are in-fact using a debug shader such as debug_coloring.mt. Shaders are the most basic expression of a surface, ranging from glass, skin, concrete, and steel. Each shader contains a combination of constant hidden-variables, and exposed variables for artists to tweak. For example, all skin exhibits some similar properties such as subsurface scattering so there is no reason to expose this; artists cannot use the skin shader without subsurface scattering. However skin color can vary dramatically, so these parameters are exposed to the artists using textures or color parameters. Artists are able to create "instances" of shaders called Material Instances which contain localized variations of the textures and properties exposed by the base shader.

Common Shader Usage

We do not have official documentation from CDPR about how shaders are used by artists. Thus any 2d/3d artist is looking at hundreds of black-box shaders with unknown usage. This is extremely demotivating for anyone looking to bring new assets to life with REDengine. The following list of tables is an attempt to make life easier for artists by using the community to document commonly used shaders.

Understanding the Documentation

The name and path of each shader will be documented by the header.

Next we are using a table for each texture parameter with the exact name listed by CDPR in the mt file, how REDengine uses each specific RGBA channel, and the usable range of the channel if not 0-1/0-255. When applicable, vertex color properties will be listed underneath the texture table with a similar format. Scalar, vector, color, and other properties will follow with their own unique description table. An asterisk (*) is used to notate some degree of uncertainty, or need for more independent testing.

Shaders

skin

base/materials/skin.mt

Texture

Red

Green

Blue

Alpha

Albedo

Color

Color

Color

?

SecondaryAlbedo

?

?

?

?

Normal

Normal

Normal

None

?

DetailNormal

Additive Normal

Additive Normal

None

?

Roughness

Roughness

None

MicroDetail mask (0.5-1)*

?

MicroDetail

Additive Normal

Additive Normal

None

?

TintColorMask

?

?

?

?

Detailmap_Stretch

Additive Normal

Additive Normal

None

?

Detailmap_Squash

Additive Normal

Additive Normal

None

?

EmmisiveMask

?

?

?

?

Bloodflow

?

?

?

?

Vertex Colors

Description

Red

Ambient Occlusion*

Green

Subsurface Scattering Mask

Blue

Improved Facial Lighting Mask

Properties

Description

SecondaryAlbedoInfluence

?

SecondaryAlbedoTintColorInfluence

?

DetailRoughnessBiasMin/Max

?

MicroDetailUVScale01/02

?

MicroDetailInfluence

Controls MicroDetail normal intensity

TintColor

?

TintScale

?

SkinProfile

?

EmissiveEV

?

CavityIntensity

?

BloodColor

?

DetailNormalInfluence

Controls DetailNormal normal intensity

Notes

  • The DetailNormal texture contains generic normal details that are shared between most faces. This is not a tiling/procedural texture. The DetailNormalInfluence scalar parameter can be used to lower the intensity to simulate makeup or synthetic skin.

  • The MicroDetail texture contains a microblend tiling texture used to add procedural detail to the normal map. We believe the Roughness texture blue channel is used to mask parts of the face from exhibiting this detail, such as the lips, eyelids, and ears.

mesh_decal

base/materials/mesh_decal.mt

Texture

Red

Green

Blue

Alpha

DiffuseTexture

Color

Color

Color

Opacity Mask

SecondaryMask

?

?

?

?

NormalTexture

Normal

Normal

None

?

NormalAlphaTex

?

?

?

?

NormalsBlendingModeAlpha

?

?

?

?

RoughnessTexture

Roughness*

Roughness*

Roughness*

?

MetalnessTexture

Metalness*

Metalness*

Metalness*

?

Properties

Description

VertexOffsetFactor

?

DiffuseColor

Procedural Color

DiffuseAlpha

Alpha

UVOffsetX/Y

?

UVRotation

?

UVScaleX/Y

?

SecondaryMaskUVScale

?

SecondaryMaskUVInfluence

?

NormalAlpha

?

UseNormalAlphaTex

?

NormalsBlendingMode

?

RoughnessScale

?

RoughnessBias

?

MetalnessScale

?

MetalnessBias

?

AlphaMaskContrast

?

RoughnessMetalnessAlpha

?

AnimationSpeed

?

AnimationFramesWidth

?

AnimationFramesHeight

?

DepthThreshold

?

Notes

  • DiffuseColor multiplies against the texture color to add procedural color

‚Äč