Creating a Layered Shader

Creating a Layered Shader

Maya 2012 Tutorial

 

How to Build a Layered Shader Using Multiple Shaders in Maya

 

 

Layered Shaders are used to create complex textures for your objects. By stacking a series of shaders, it is possible to build a composite a texture, similar to Photoshop layers.

In addition to Layered Shaders you can also create Layered Textures. Blinn, Lambert and Phong are examples of shaders. Textures include Files, Movies and Procedural Textures. One advantage of Layered Textures is that you can use blending modes (i.e., Multiply and Lighten) to build your texture. For more information on Layered Textures, see topic, Creating a Layered Texture.

In this example we will be combining an image of the letter A and a texture. We will also create a mask image to reveal the texture.

 

Step One

Open a new Maya document and start a new project. Be sure to set your project and save your new scene. For more information, see topic, Starting a Project.

Step Two

Add a polygon plane to the workspace by choosing Create > Polygon Primitives > Plane.

Step Three

In Photoshop, open a new 1,024 pixel x 1,024 pixel RGB document with a black background. Add large red letter A to the document.

Step Four

Choose File > Save As to save your image in your project's sourceimages folder. Name the image letterA.jpg.

Step Five

With the image file still open, Change the letter color to white.

Step Six

Choose File > Save As and save your white letter as mask.jpg in your project's sourceimages folder.

Step Seven

Click the Create a New Layer icon to add a new layer at the top of the stack.

Step Eight

With nothing selected, fill the new layer with a pattern by choosing Edit > Fill. Choose Use: Pattern from the pull-down menu. To see more pattern libraries, click the right facing arrow in the upper right corner of the Pattern dialog box.

Step Nine

Choose File > Save As to save your pattern image as texture.jpg in your project's sourceimages folder.

Step Ten

Returning to Maya, select the plane, then right-click the plane and choose Assign New Material. Select Layered Shader from the Maya section.

Step Eleven

In the Attribute Editor, layeredShader tab, the shaders appear as a series of rectangles with the topmost shader on the left. Currently, the Layered Shader has only one layer since there is only one rectangle.

Step Twelve

Move the Transparency slider all the way to the left, then click the Color checkerbox. In the Create Render Node, 2D Textures section, right-click File and choose Create Texture.

Step Thirteen

In the Attribute Editor, File Attributes section, click the Folder icon to connect to the letterA.jpg file in the sourceimages folder.

Step Fourteen

Return to the Attribute Editor, layeredShader tab and click the area just to the right of the first rectangle to add a second layer.

Step Fifteen

With the new right rectangle selected, move the Transparency slider all the way to the left. Click the Color checkerbox and add the texture.jpg file as you did in Step Twelve and Step Thirteen.

Step Sixteen

Click the Render Current Frame icon to view your shader. Notice that the underlying texture is being blocked by the upper layer.

Step Seventeen

Return to the Attribute Editor, layeredShader tab and click the left rectangle, then click the checkerbox next to the Transparency slider.

Step Eighteen

Add a File node as you did in Step Twelve and Step Thirteen and attach the mask.jpg file to the layer's transparency.

Step Nineteen

Click the Render Current Frame icon to view your shader. The letter now rests on top of the texture.

Alpha Channels are Grayscale Images

In this example we used a mask that was black and white. The white areas revealed the layer below. If you used a mask with various grayscale values the mask would vary from transparent to opaque.

Another Mask Option

For our mask, we used the mask.jpg file. Another option is to create your color image (letterA.jpg) with an alpha channel and save it as a tif file. To specify transparent areas of the texture the alpha channel is black. Opaque areas appear as white in the alpha channel. For an example of this technique, see topic, Adding a Label to a Bottle - Method Three.

Stacking Shaders and Textures

In this example we used a series of texture files to create our stack. You can also use various shaders (i.e., Blinn or Lambert) to build your stack. For an example of stacking shaders instead of textures, see topic, Adding a Label to a Bottle - Method Three.