Share

Layer RGBA - Arnold User Guide

The Layer RGBA shader can be used to linearly layer up to eight shaders together, enabling you to create complex shading effects. Layers are applied in order (bottom to top) according to a blending mode specified in the operation. The layer alpha can optionally be a separate input. A use for this shader could include adding text to an image for example.

Enable (1-8)

Enable/disable the layer entirely.

Name (1-8)

Layer name.

Input (1-8)

Input value for Layer.

Mix (1-8)

Controls the amount of blending between shaders.

You may need to insert a Range shader when connecting a bitmap to Mix.

Operation (1-8)

The blending mode for the current layer. They emulate all of Nuke and Photoshop's modes. In the formulas, A (Layer 1) is the upstream intermediate result, and B (Layer 2) is the current layer.

  • overwrite : B
  • atop : A * B.a + B * (1 - A.a)
  • average : (A + B) / 2
  • cojoint_over : A if A . a > B . a else A + B * ( 1 - A . a ) / B . a
  • color_burn : 1 - (1 - A) / B
  • color_dodge : A / (1 - B)
  • difference : abs(A - B)
  • disjoint_over : A + B * (1 - A.a) / B.a, A + B if A.a + B.a < 1
  • divide : A / B, 0 if A and B < 0, else A if B < epsilon
  • exclusion : A + B - 2 * A * B
  • from : B - A
  • geometric : 2 * A * B / (A + B)
  • glow : B 2 / (1 - A)
  • hard_light : 1 - 2 * (1 - A) * (1 - B), 2 * A * B if A < 0.5
  • hard_mix : vivid_light(A, B) < 0.5 ? 0 : 1
  • hypot_diagonal : √(A 2 + B 2 )
  • in : A * B.a
  • linear_light : ( B < 0.5 ) ? A + 2 * B - 1 : A + 2 * ( B - 0.5 )
  • mask : B * A.a
  • matte : A * A.a + B * (1 - A.a)
  • max : max(A, B)
  • min : min(A, B)
  • minus : A - B
  • multiply : A * B, A if A and B < 0
  • negation: 1 - abs(1 - A - B)
  • out : A * (1 - B.a)
  • over : A + B * (1 - A.a)
  • overlay : hardlight(B, A)
  • phoenix : min( A , B ) - max( A , B ) + 1
  • pin_light : B < 0.5 ? min( A , 2 * B ) : max( A , 2 * ( B - 0.5 )
  • plus : A + B
  • reflect : A 2 / (1 - B)
  • screen : A + B - A * B if A and B in 0..1, else max(A, B)
  • soft_light : Softer version of hard_light
  • stencil : B * (1 - A.a)
  • subtract : A + B - 1
  • under : A * (1 - B.a) + B
  • vivid_light : B < 0.5 ? color_burn( A , 2 * B ) : color_dodge( A , 2 * ( B - 0.5 )
  • xor : A * (1 - B.a) + B * (1 - A.a)
Atop: A * B.a + B * (1 - A.a) Average: (A + B) / 2 Cojoint Over: A if A.a > B.a else A + B * (1 - A.a) /B.a Color Burn: 1 - (1 - A) / B
Color Dodge: A/ (1 - B) Difference: abs(A - B) Disjoint Over: A + B * (1 - A.a) / B.a, A + B if A.a + B.a < 1 Divide: A / B, 0 if A and B < 0, else A if B < epsilon
Exclusion: A + B - 2 * A * B From: B - A Geometric: 2 * A * B / (A + B) Glow: B2 / (1 - A)
Hard Light: 1 - 2 * (1 - A) * (1 - B), 2 * A * B if A < 0.5 Hard Light: 1 - 2 * (1 - A) * (1 - B), 2 * A * B if A < 0.5 Hypot Diagonal: hypot_diagonal: √(A2 + B2) In: in: A * B.a
Linear Light: (B< 0.5) ? A + 2* B- 1: A + 2 * (B - 0.5) Mask: B * A.a Matte: A * A.a + B * (1 - A.a) Max: max(A, B)
Min: min(A, B) Minus: A - B Multiply: A * B, A if A and B < 0 Negation: 1 - abs(1 - A - B)
Out: A * (1 - B.a) Over: A + B * (1 - A.a) Overlay: hardlight(B, A) Overwrite: B
Phoenix: min(A, B) - max(A, B) +1 Pin Light: B < 0.5 ? min(A, 2 * B) : max(A, 2 * (B - 0.5) Plus: A + B Reflect: A2 / (1 - B)
Screen: A + B - A * B if A and B in 0..1, else max(A, B) Soft Light: Softer version of hard_light Stencil: B * (1 - A.a) Subtract: A + B - 1
Under: A * (1 - B.a) + B Vivid Light: B < 0.5 ? color_burn(A, 2 * B) : color_dodge(A, 2* (B - 0.5) XOR: A * (1 - B.a) + B * (1 - A.a)

Normal Map

It is possible to blend multiple normal maps using the normal map blending operation.

Alpha Operation (1-8)

Optional alpha value for Layer.

Result : The alpha is computed in the same way as the other color channels (follows the "operation" for the RGB channel).

Preserve : Keeps the old alpha value ( A.a ).

Overwrite : The alpha channel is overwritten by the alpha of the current layer ( B.a ).

Mask : Calculated as: A.a + B.a - A.a * B.a.

Atop Average Cojoint Over Color Burn
Color Dodge Difference Disjoint Over Divide
Exclusion From Geometric Glow
Hard Light Hard Mix Hypot Diagonal In
Linear Light Mask Matte Max
Min Minus Multiply Negation
Out Over Overlay Overwrite
Phoenix Pin Light Plus Reflect
Screen Soft Light Stencil Subtract
Under Vivid Light XOR

Clamp Result

Clamp all intermediate results to [0,1].

Example of layer_RGBA shader used to layer a graffiti texture onto a brick texture

Was this information helpful?