I’m feeling a bit lazy so I just cut and pasted this:
Open the Hypershade. Select Create -> Material -> Phong to create a phong material node. Open up the node in the Attribute editor and set the following:
Color to Black;
Transparency to White;
Diffuse to 0;
Translucence to 0;
Cosine Power to 50;
Under Raytrace Options set the following:
Refractions to On;
Refractive Index to 1.33;
Refraction Limit to 6;
Reflection Limit to 1.
These settings offer the desired qualities for glass.
STEP FOUR
Assign the phong shading group to the glass. Now you can test render the scene to evaluate this basic glass shader.
To raytrace the glass, you must follow the steps outlined in How to set up reflections and refractions. The reflections and refractions lesson will teach you how to set up critical attributes on your various props to ensure that they are reflected and refracted properly. You will also learn how to set up your Render Globals for raytracing.
STEP FIVE
In the Hypershade, select Create -> Create Render Node. This will open the Create Render Node window. and under the Utilities tab, create the following utility nodes:
3 Blend Color nodes,
1 Sampler Info node
The Sampler Info node is a special utility node that returns values when a point is sampled on a surface during rendering. These values can be mapped to other nodes to create unique effects. In this lesson, the Sampler info node will control the blending of two colors in each of the three Blend Color nodes.
Rename the three Blend Color nodes to the following:
colorBC, reflectBC, transpBC
This will help you distinguish the purpose of these nodes as you build the glass shading network.
STEP SIX
In the Hypershade, drag the samplerInfo node onto the colorBC node. The Connection editor will open. Connect the Facing Ratio attribute to the Blender attribute.
The Facing Ratio attribute returns a value between 0 and 1 based on how much the sampled point is facing the camera. If you were looking at a cylindrical glass head on, the Facing Ratio values would go from 0 at the sides of the glass to 1 at the center.
Repeat this step two more times to connect the samplerInfo node’s Facing Ratio attribute to the Blender attribute belonging to the reflectBC and the transpBC nodes. Now the samplerInfo node is connected to all three Blend color nodes.
STEP SEVEN
Open up the transpBC node in the Attribute editor. Set Color1 and Color2 as shown here. This will create a blend from light gray to white.
Drag the transpBC node onto the phong shading group.
In the Connection editor, connect the transpBCs Output attribute to the phong’s Transparency Attribute.
Now the transparency of the glass will appear stronger at the center of the glass and slightly less transparent at the edges. Test render to compare the results. You may want to darken the gray blend color to make the edges even less transparent.
Note: The value of the blending colors [1.0 for white and approximately 0.8 for the light gray] will be used to set the transparency value. To find out the value of a color that you choose, open the Color editor and look at the Value that is shown as part of Hue, Saturation and Value. A similar mapping of color values will apply to setting the reflectivity of the glass.
STEP EIGHT
Open up the reflectBC node in the Attribute editor. Set the Color1 and Color2 as shown here. This will create a blend from white to light gray.
Drag the reflectBC node onto the phong shading group.
In the Connection editor, connect the reflectBC’s Output R attribute to the phong’s Reflectivity Attribute.
Now the reflectivity of the glass will be strongest at the edges of the glass and slightly less strong where the glass faces the camera. Test render to compare the results. You may want to darken the two blend colors to lower the amount of reflection on the glass.
STEP NINE
Open up the colorBC node in the Attribute editor. Set the Color1 and Color2 as shown here. This will create a blend from black to dark gray.
Drag the colorBC node onto the phong shading group.
In the Connection editor, connect the colorBC’s Output attribute to the phong’s Color Attribute.
Now the color of the glass will be black at the edges of the glass and a dark grey where the glass faces the camera. Test render to compare the results. You may want to change the two blend colors to alter the colors of the glass.
CONCLUSION
You now have a glass rendering that uses Maya’s utility nodes to create subtle reflection and refraction effects. You can easily alter the look of the glass by editing the various blend colors to suit your needs.