Up until now we have been using the default shader, known as "lambert1". This matte, middle-gray shader is charming in its own way, but limits the visual interest of objects. In this exercise we will explore the ins and outs of adding different shaders to objects. The words "shader" and "material" mean the same thing and we will be using them interchangeably.
The most basic way to apply a shader to an object is to Right click it and navigate to Assign New Material.... A menu will pop up with a number of options such as Blinn, Phong, and Lambert as well as some more exotic shaders. These shader types vary in the calculations they use to render the object. If you wish to apply an existing shader to an object, then select it from the Assign Existing Material menu instead. Try assigning a Blinn shader to an object.
Assigning a new material should bring up your Attribute Editor with information about the shader. If you have already applied the shader, you can get to this window by selecting the object and then selecting the "blinn1" tab in the Attribute Editor or by selecting Material Attributes... from the Right click menu for an object.
The Attribute Editor allows you to tweak the various properties of the material. The most important of these are located under Common Material Attributes and Specular Shading. Most common shaders will have these two, with the exception of Lambert, which has no specular (The bright highlights you see on objects).
To adjust the material's attributes, you can drag the bars or type in an exact value. Notice that the shading of the object changes in the preview thumbnail at the top as well as in the camera view. To set a color to something besides a gray value, click the color box. This will bring up a color picker that will allow you to choose any color you wish. Try playing around with the various material attributes now. You may want to use Renderer → High Quality Rendering or click the icon in the viewport.
The other method to create and edit shaders is to use the Hypershade, which can be found at Window → Rendering Editors → Hypershade. The Hypershade provides a high level view of all the shaders in your scene. By default, every scene will contain the shaders "lambert1", "particleCloud1", and "shaderGlow1". As a rule of thumb, you should never modify these shaders. Create a new shader if you want to change the default look.
New shaders can be created by clicking the buttons on the left of the Hypershade. The shader's attributes can be brought up by double clicking the shader. To assign a shader to a set of objects, select the objects and then Right-click the shader in the Hypershade and select Assign Material to Selection. Similarly, you can see which objects are shaded by a certain material by Right-clicking it and selecting Select Objects With Material.
If you could only adjust the attributes of shaders, then Maya's shading system would be fairly weak. Maya gains its power through the ability to compose different render nodes into complex networks. You may have noticed the checkered box () to the right of all of the material attributes. Clicking this button will allow you to "map" in the values from a render node. Click the checkered box for "Color" in the material you created.
This will bring up the Create Render Node window with a variety of options. The 2D Textures will map a value based on the object's UVs and the 3D texture will map a value based on the surface's point in space. We will discuss UVs further in UV Editing. The most important render node is File, which will allow you to use textures you created in Photoshop and the like. Try mapping various render nodes into Color to see how the color is affected. The sphere below was created by mapping a Ramp into the Color.
After you have mapped in a render node, if you return to the material's attributes there should be an arrow () where the checkered box once was. Clicking this box will bring you to the attributes of the render node. Similarly, you can navigate using the arrows at the top of Attribute Editor. To map in a different render node, you must first break the existing connection. Right click the name of the attribute and select Break Connection to break the connection.
Note that only the connection to the render node is broken, the node still exists within the Maya scene and can be found in one of the Hypershade's tabs (for example, a Ramp texture node would be found under the Texture tab). Be careful not to let these unused nodes excessively clutter your scene. They can be selected and deleted individually, or you can navigate to Edit → Deleted Unused Nodes to delete them all.
At times it will be convenient to have a mapped node repeat across the surface of an object. To illustrate this, map a Checker render node into the Color of the sphere. If you do not see the sphere update, hit 6. After you have mapped in the Checker node, at the top of the Attribute Editor, you should see a tab called "place2dTexture". Click this tab to view its attributes. By default, the Repeat UV attribute of Checker should be 4 and 4 for the U and V directions respectively. Try altering these values to see how the checker pattern is affected.
A very useful aspect of a shader is its bump map. A bump map simulates small height changes on the surface of an object. This can be used to show scratches, grain, or other surface imperfections. This could be done in geometry, but this would be extremely time consuming and difficult to edit. A bump map doesn't actually change the geometry of the object it is shading, only the way the light strikes it. This can be seen by looking at the silhouette of the object.
A bump map is a grayscale image. The darker parts of the image represent areas that are low while the lighter parts are higher. A sharp change from black to white will create a sharp upwards bump. The images below show a bump map being used. The image on the left shows the bump map as a color and the image on the right shows the result when it is used as bump. When you map in a bump map a Bump2D or Bump3D node is created between the shader and the bump map. In this node you can adjust the contrast of the bump map to make the surface less bumpy. You must render an object to see the bump map correctly applied.
You now know the basics of shading. Continue on to the other exercises to learn more about the basics of Maya.