How to Render Glass in Maya and Mental Ray

Learn How to Render Visually Accurate Glass With Mia_Material_X

Close-up of water in glass against white background
Yothin Sanchai / EyeEm / Getty Images

So, you need to render glass in Maya and don't know where to start. If you're relatively new to Maya and don't have a lot of experience using the Mental Ray renderer plugin, your first impulse might be to grab a standard Blinn material and bump up the transparency until it's relatively clear.

This may work as a viewport stand-in when you're blocking out your image, but Maya's software shaders are typically unsuitable for physically accurate rendering.

To create glass, you need to use a versatile Mental Ray shader called mia_material_x.

Locate Mia_Material_X

Mental Ray's Mia shader is an all-purpose material network designed to be a physically accurate solution for just about any inorganic surface you can imagine including chrome, stone, wood, glass, and ceramic tile.

The mia_material_x node should form the basis of nearly every material you build in Maya, aside from skin shaders.

To find mia_material_x, click the Hypershade window > Mental Ray > Materials > mia_material_x.

The standard MIA shader is a neutral gray with a sharp specular highlight. 

Customizing the Mia Material

Set up a test scene with a basic piece of geometry and some simple studio lighting to work through the process of setting the parameters in Mental Ray.

The mia material has a vast array of options. Some of them will be important to you, but a lot of them you can ignore. Arriving at a basic glass shader is relatively simple—things only begin to get tricky when you need to fill the glass with a liquid.

Your success in rendering glass depends on how well you set several parameters: Diffuse, Refraction, Reflection, Specularity, and Fresnel Effect.

Diffuse Parameter

You're creating a colorless, clear glass, so the job in the Diffuse tab is incredibly straightforward. Diffuse light gives a form its surface color. Because the glass in this example is clear, you do not need any diffuse reflections in the shader. Under the diffuse tab, change the value of the weight slider to zero.

Refraction

The Refraction tab is where you deal with the glass material’s transparency value.

The first thing you need to adjust is the index of refraction parameter, which corresponds to a relatively specific real-world index of refraction values that exists for all naturally transparent surfaces.

If you hover over the Index of Refraction tab, a small list of approximate values for different materials pops up. Water has an index of refraction around 1.3. Crown glass has a real-world index of refraction at approximately 1.52. Set the index of refraction to 1.52.

The last thing you need to tweak in the refraction tab is the transparency value. You're creating a fully transparent glass shader, so set the transparency value to 1. 

Reflection

The Reflection tab determines how much of the glass's environment is reflected in the final render. Even when it is clear, the glass should have a high amount of glossiness and reflectivity.

Leave the ​glossiness value at 1.0 and change reflectivity to a value somewhere between 0.8 and 1. A little bit of subjectivity is OK here depending on the look you want in your final image, but the reflectivity value shouldn't drop below 0.8.

Specularity

If you do a test render at this point, you'll see that you're getting close to having decent-looking glass, but there are still two attributes you need to know about.

If you compare your current result with real-world glass, you'll see that the surface is currently a bit too busy to be called realistic. Right now the mia_material is reflecting the environment, which is good, but it's also computing glossy reflections based on specularity, which is bad.

Specular highlights are a holdover from earlier days of CG when glossy reflections had to be faked. It's still an important attribute in CG surfacing, but in this case, it's giving you a less realistic result than you'd like to see. You want to retain the reflected environment but lose the specular-related highlights that are currently showing up in the renders.

Find the Specular Balance attribute under the Advanced tab and set it to zero.

Fresnel Effect

Now the surface of the glass display is uniformly reflective when, in reality, you should see weaker highlights where the glass faces the camera and stronger highlights toward the edges where the glass curves away. This is called the Fresnel effect.

Because the Fresnel effect is a relatively common phenomenon, the mia_material has a Fresnel attribute built into it. All you have to do is turn it on.

Open the BRDF tab (short for Bidirectional Reflectance Distribution Function) in the material attributes window, and check the box labeled Use Fresnel Reflection.

You should see the result change quite a bit. 

Conclusion

The mia_material_x has a glass preset called solid glass that is close to the shader you just created. In fact, it's close enough that it's probably good enough for most of your needs.

It's always good to know how something is made, though. By creating the shader yourself, you learn which attributes contribute to different aspects of the shader, and you're, therefore, more able to tweak the shader to your liking in the future or create variations on it for slightly different effects.

That said, if you want to use the glass preset, simply open the material attribute window for a mia_material_x, hold down the ​preset button in the upper right corner of the window and go to ​Solid glass > Replace.