Direction blend shaders

These are standard PBR shaders that blend two sets of textures based on the meshes red vertex color and slope angle.

They are a variation of the blend shaders.

Shader table

Shader

Texture
diffuse
Texture
specular
Texture
normal
Texture
diffuse1
Texture
specular1
Texture
normal1
Texture
normal2
Parameter
Parameter
Parameter
ambient

DirectionBlend_dpndpn

DirectionBlend_dpnndpn

Behavior

Standard behaviors
Rendering

The shaders only support deferred rendering and have not been compiled for forward rendering.

Transparency

Support only transparency clipping, and not transparency blending.

The shader uses the final blending factor as the alpha.

Texture coordinates

DirectionBlend_dpnndpn uses each textures provided texture coordinate index, while DirectionBlend_dpndpn uses a specific one per texture.

Multiple Tangents

These shaders can use a second set of tangents for the second set of textures when the bool parameter enable_multi_tangent_space is set to true.

Vertex colors

The red vertex color is used for the slope blending bias.

Mysteriously, the DirectionBlend_dpnndpn shader allows the combination of the RGB channels by using the ambient parameters red component as a blending factor.

Texture Blending

These shaders rely on the meshes slope angle to determine the blending factor, which is used to blend the two sets of textures together.

Additionally, the red vertex color is used as a “blending bias”:

../../../_images/direction_blend_bias.png

A sphere with two textures being blend together and a gradually increasing blending bias.

A blending bias of 0.5 is considered the default.

Distance blending

The DirectionBlend_dpnndpn shader will fade in the normal2 based on the distance between the camera and surface being rendered. The game usually starts the fade-in at a distance of 180, and fully fades them in at a distance of 150.

Textures

diffuse

A standard albedo texture.

The alpha is used to adjust the slope blending factor via multiplication.

Uses the 1st UV channel. *

specular

A standard PRM texture.

Uses the 1st UV channel. *

normal

A standard normal map texture.

Uses the 1st UV channel. *

diffuse1

A standard albedo texture.

The alpha is used to adjust the slope blending factor via multiplication.

Attempts to use the 3rd UV channel. *

specular1

A standard PRM texture.

Attempts to use the 3rd UV channel. *

normal1

A standard normal map texture.

Uses the 3rd UV channel.

Warning

This texture is not used in the BlendDetail_dpndpnn shader!

Yet, a slot is required to be able to specify the normal2 texture, even if this one is left empty!

normal2

A standard normal map texture.

Attempts to use the UV channel specified by the textures texcoord index.

Gets blended together with the normal texture (influenced by the camera distance).

Parameters

DirectionParam

A normal direction that determines which direction the slope blending starts.

NormalBlendParam

A float parameter to modify the slope blend factor.

  • The first component changes the blend factors strength (multiplicative).

  • The second component raises the minimum blend factor (additive).

ambient

A float parameter containing a color.

The red component changes the visibility of the vertex colors on the diffuse texture.

A value of 1 hides the vertex colors, while a value of 0 makes them fully visible.