Written by Danny McNezmo
With this tutorial I will show you how to set up a realistic glass shader for the mental ray renderer. If you are creating glass you must pay attention to the three attributes: Reflection, Refraction and Transparency.
We will map some color ramps on these attributes to achieve a nice realistic impression of glass. You can use the model of the glass from the othr modeling tutorial called The Goblet.
Maya tutorial: The Glass Shader
STEP 1: Create an Anisotropic material and name it "Glass".
STEP 2:Click on the checker icon on the left next to the Transparency attribute. The texture menu will appear. Select the Ramp.
Make the black and white gradient as in the picture.
Go back to the attribute editor of your Glass material and click the checker icon next to the Reflected Color attribute. Again select the Ramp.
This time make the ramp white only. (see the picture)
Now go to the Hypershade (Window>Rendering Editors>Hypershade). In the menu on the left select the Sampler Info Utility node. You will find it under General Utilities.
Click and drag the Sampler Info node (middle mouse button) and drop it on the black and white Reflection ramp node. A small pop up menu will appear. Choose "other" at the bottom of the menu.
The connection editor will appear. Now you have to connect the Facing Ratio with the V Coordinate aspect. You will find the V Coordinate aspect under the UV Coord. Just click on the + icon next to UV Coord and the aspect you are looking for will show up.
Do the same thing with the other ramp. Middle mouse button drag and drop the Sampler info node on the white Transparency ramp. Again connect pokies online the Facing Ratio with the V Coordinate aspect.
Now your Hypershade window should looks as in the picture. Go and assign your Glass material to the object (the Goblet in our case)
Now you have to do one last thing. You must correctly set up Ray tracing for mental ray. Open the mental ray rendering settings and in the mental ray tab check the Ray tracing tick box. Set the values on 20; 20; 10; 2 as in the picture. You must also set the material Raytrace Options. Go into the attribute editor for your glass and find the Raytrace Options drop down menu. Open the menu and edit these values: Refractive Index = 2, Refraction Limit = 12, Reflection Limit = 0 (reflection limit set up to 0 will shorten the rendering time).
Now go and play with the settings of Ray tracing and Retrace Options. You can achieve very nice glass results with this fast method of combining the shader set up. It is always good to put some background behind the glass object. Also try to change different types of lights to lighten the scene so you can see the different reflections in the glass material.
Note: inspired by Aniquito