Layered Textures


This tutorial will show how to make a Layered Texture shader, including the "label" effect similar to Stencil mapping.

For the "label" part of this example you will need an image with an alpha channel:

Create three File texture nodes. Load the "label" texture with alpha into the first node and a texture into #2 and #3 (in this example, "steel" and "rust").
Create a Layered Texture node and connect the color output from the "label" texture to the inputs[0].color of the Layered Texture.
Next, connect the color output from File node #2 ("steel") to the inputs[1].color of the Layered Texture and also to the Default Color input of the "label" texture . (See the Stencil Mapping page for an explanation of why this is done.)
Change the values of the U and V Coverage and Translation on the "label" texture's place2dTexture node in order to shrink the label image down in size and center it.

The next step is to connect the Alpha output of the "label" texture node to the input[0].alpha on the Layered Texture node. Depending on the alpha channel, you might notice in the hypergraph swatch, or if you do a test render, the alpha mask is inverted, so you need to reverse it. Create a "reverse" node from the "Create > General Utilities" menu. Connect the "label" texture's Alpha out to the Reverse node's input.X, then connect the Reverse node's output.X to the input[0].alpha and the result will be an inverted alpha channel that will render correctly.

Connect the color output of File node #3 ("rust") to the inputs[2].color of the Layered Texture. To create a custom mask that combines the "steel" and "rust" in a marbled pattern, create a fractal texture and connect it to the input[1].alpha on the Layered Texture. A higher setting in the amplitude of the fractal will create sharper transitions in the black and white mask. The resulting graph should look like the one below (click to see a larger view).

This render differs from the one at the top of the page: There is a bump map on the surface that is fainter in the area of the label, and the rusty areas do not have specular highlights like the other areas. To get this effect, see the page on Selective Masking of Specular and Bump Maps. (coming next).