Go to: Related nodes. Attributes.

The Layered Texture node can be used to layer multiple textures one on top of another to produce a single result texture.

There are also a number of different blend modes which you can use to specify exactly how each layer is to be composited with the layers beneath it.

To use the layered texture node, connect the outColor and/or outAlpha attributes of the various layers to the inputs[x].color and inputs[x].alpha attributes of the layered texture node respectively.

This node is MP safe

Node nameParentsClassificationMFn typeCompatible function sets
layeredTextureshadingDependNodetexture/other:drawdb/shader/texture/2d/layeredTexturekLayeredTexturekBase
kNamedObject
kDependencyNode
kLayeredTexture

Related nodes

envCube, envSphere, envSky, envBall, envChrome, bump3d, uvChooser, bump2d, texture2d, ramp, file, cloth, water, stencil, checker, fractal, bulge, grid, mountain, texture3d, projection, cloud, granite, crater, leather, stucco, brownian, solidFractal, marble, wood, rock, snow, defaultTextureList, place2dTexture, place3dTexture

Attributes (22)

alpha, alphaIsLuminance, blendMode, color, colorB, colorG, colorR, hardwareColor, hardwareColorB, hardwareColorG, hardwareColorR, inputs, isVisible, outAlpha, outColor, outColorB, outColorG, outColorR, outTransparency, outTransparencyB, outTransparencyG, outTransparencyR

Long name (short name)TypeDefaultFlags
inputs (cs) compoundn/aarrayoutputinputconnectablestorablekeyable
This is the list of input colors and alphas that will be combined in this Layered Texture.
color (c) float3outputinputconnectablestorablekeyable
Color affects the final color of the layered texture. Connect the output color attributes of other textures to this attribute to combine them into a single texture.
colorR (cr) float0.0outputinputconnectablestorablekeyable
color red value
colorG (cg) float0.0outputinputconnectablestorablekeyable
color green value
colorB (cb) float0.0outputinputconnectablestorablekeyable
color blue value
alpha (a) float1.0outputinputconnectablestorablekeyable
Alpha
blendMode (bm) enum1outputinputconnectablestorable
Use the Blend Mode to control how successive layers of textures are combined together. There are a number of blend modes which can specify exactly how to blend a texture with the textures beneath it.

Here we present two descriptions of the different blend modes. The first description is a non-technical definition of each blend mode for the benefit of someone who wants to know what each one does. The second is a technical definition of each blend mode for the benefit of someone who is attempting to imitate their function in hardware. In both cases we will refer to the texture whose blend mode is being specified as the "foreground" texture, and the result of all of the underlying textures blended together (according to their particular blend modes) as the "background" texture.

The non-technical definitions are as follows:

  • None: The foreground texture covers up the background texture entirely.
  • Over: The foreground texture is applied like a decal to the background. The shape of the decal is determined by the foreground alpha.
  • In: The result is the background texture cut in the shape of the foreground alpha.
  • Out: The result is the opposite of In. It is as if the shape of the foreground alpha has been cut out of the background.
  • Add: The result color is the foreground color added to the background color as if being projected on the background through a slide projector. The result color is then applied over the background color using the foreground alpha to define the opacity of the result.
  • Subtract: The result color is the foreground color subtracted from the background color. The result color is then applied over the background color using the foreground alpha to define the opacity of the result.
  • Multiply: The result color is the foreground color multiplied by the background color. The result color is then applied over the background color using the foreground alpha to define the opacity of the result.
  • Difference: The result color is the difference between the foreground color and the background color. The result color is then applied over the background color using the foreground alpha to define the opacity of the result. Difference is not supported by hardware texturing.
  • Lighten: The result color of each pixel is the background color or foreground color, whichever is lighter. The result color is then applied over the background color using the foreground alpha to define the opacity of the result. Lighten is not supported by hardware texturing.
  • Darken: The result color of each pixel is the background color or foreground color, whichever is darker. The result color is then applied over the background color using the foreground alpha to define the opacity of the result. Darken is not supported by hardware texturing.
  • Saturate: The result color is the background color with saturation increased in proportion to the foreground color scaled by foreground alpha. If the foreground color is red, for example, the result color will be the background color with more saturated reds.
  • Desaturate: The result color is the background color with saturation decreased in proportion to the foreground color scaled by foreground alpha. If the foreground color is red, for example, the result color will be the background color with desaturated reds.
  • Illuminate: The result color is the background color mixed with the foreground color, brighter where the foreground is bright and darker where the foreground is dark. It is as if the foreground texture represents the light falling on the background. The result color is then applied over the background color using the foreground alpha to define the opacity of the result.

The following descriptions describe the blend modes in a technical fashion.

Let "fc" be the foreground color
Let "fa" be the foreground alpha
Let "bc" be the background color
Let "ba" be the background alpha
Let "color" be the result color

Let "alpha" be the result alpha

  • None:
    color = fc
    alpha = fa
  • Over:
    color = fc * fa + (bc * (1 - fa))
    alpha = 1 - ((1 - ba) * (1 - fa))
  • In:
    color = bc * fa
    alpha = ba * fa
  • Out:
    color = bc * (1 - fa)
    alpha = ba * (1 - fa)
  • Add:
    color = bc + (fc * fa)
    alpha = ba
  • Subtract:
    color = bc - (fc * fa)
    alpha = ba
  • Multiply:
    color = bc * (fc * fa + 1 - fa)
    alpha = ba
  • Difference:
    color = (abs((fc * fa) - bc)) * fa + bc * (1 - fa)
    alpha = ba
  • Lighten:
    color = (max((fc * fa), bc)) * fa + bc * (1 - fa)
    alpha = ba
  • Darken:
    color = (min((fc * fa), bc)) * fa + bc * (1 - fa)
    alpha = ba
  • Saturate:
    color = bc * (1 + (fc * fa))
    alpha = ba
  • Desaturate:
    color = bc * (1 - (fc * fa))
    alpha = ba
  • Illuminate:
    color = bc * (2 * fc * fa + 1 - fa)
    alpha = ba
isVisible (iv) booltrueoutputinputconnectablestorable
Specifies whether the layer is visible
outColor (oc) float3outputconnectable
output color
outColorR (ocr) float0.0outputconnectable
outColor red value
outColorG (ocg) float0.0outputconnectable
outColor green value
outColorB (ocb) float0.0outputconnectable
outColor blue value
outAlpha (oa) float0.0outputconnectable
output alpha
hardwareColor (hc) float3outputinputstorable
Hardware Color defines the color to be used in shading objects using this layered texture when in hardware shaded but not hardware textured mode.
hardwareColorR (hcr) float0.5outputinputstorable
hardware color R value
hardwareColorG (hcg) float0.5outputinputstorable
hardware color G value
hardwareColorB (hcb) float0.5outputinputstorable
hardware color B value
alphaIsLuminance (ail) boolfalseoutputinputconnectablestorable
If true, the outAlpha of the layered texture will be the luminance of the outColor. Useful for bump mapping or displacement mapping.
outTransparency (ot) float30.0, 0.0, 0.0outputconnectable
Out Transparency is the transparency computed by this texture. Each channel of Out Transparency (R, G, B) is 1 - outAlpha. Connect this value to a transparency attribute of a shader to texture map that color.
outTransparencyR (otr) float0.0outputconnectable
Out Transparency red value.
outTransparencyG (otg) float0.0outputconnectable
Out Transparency green value.
outTransparencyB (otb) float0.0outputconnectable
Out Transparency blue value.