Alias Maya Tutorials
Home Tutorials Resources Links Contact

The L_Glass Shader for Alias Maya 7

The l_glass shader is a shader which is no longer in development, and has little written resources about it. Yet to date it is still one the most accurate and widely used mental ray shaders for glass. This material was built off of mental ray's built-in Dielectric shader node, but has many more features, and flat-out just looks better.

This tutorial was built using l_glass in Alias Maya 7, but should also work with Alias Maya 6.5 and Autodesk Maya 8. The l_glass shader can also be used in XSI, yet the workflow will be different.

You will need a stable l_glass shader for tutorial. The version I am using is Version 1.2. Get it from our Resources section.

There are two methods to making realistic glasses filled with liquid using the l_glass shader.

   1)  Create the glass with the l_glass shader and fill it with a Maya Fluid. (More control, necessary for moving liquid animation)
   2)  Create the glass with the l_glass shader and assign a different level of refraction to the liquid-filled part. (Easier yet still realistic, can be done without an Unlimited license)

Don't get scared away by some of these big words. For those of you who know what I'm talking about, we're going to use the second strategy in this tutorial. Let's get started.


I'm not going to go too much into modeling because I'm sure everyone has a different glass shape they want to use. Now's the time to make that decision. You need to decide:

- What shape glass?
- What liquid?
- How full is the glass?

For the sake of this tutorial, I'm going to be creating a rounded wine glass that's two-thirds filled with white wine. Find some visual reference and start to make this glass. NURBS of course is preferred for any surface as smooth and simple as a glass.

Switch to your front viewport and make half of a glass using a single curve. Make sure to snap the beginning and end control vertices to the y-axis. Keep the wall of the glass fairly thin, like a normal glass should be.

First rough outline.
Finished curve.

Okay, mine's not perfect, and the rounded shape of it would make drinking from it really inconvenient, but it's the l_glass shader that we're worrying about. If you revolve your shape around the y-axis (the default axis), you should end up with a decent glass. Pick revolve from the menu ("Surfaces, Revolve") and admire your results.

Revolved wireframe.

Detaching & Lofting:

There is only one detach that needs to be done, but it's a fairly important one. Find the isoparm on the inside of the glass wall (make sure it's inside!) that you want your liquid to go up to. It's a lot easier to find the inside isoparms if smooth shading or x-ray is the viewing mode. Once you have it selected, go to the Modeling Menu, then select from the top "Edit NURBS/Detach Surfaces". Now you can see that we have two separate pieces of geometry.

Detached. The top piece is selected.

You need to do a loft. This loft is to create the top surface of the wine. In case you never took high school physics, the surface of all liquids have a slight dip to them, centered at the furthest point from all touching surfaces. We can simulate this tiny dip with a lofted surface.

First you should hide your outer glass. That's only going to get in the way. The keyboard shortcut for Hide is Ctrl+H, and you can re-show something by selecting it in the outliner and keying Shift+H. Now that you can only see your inner glass, select the uppermost isoparm ("Right-click the surface/Isoparms" to display isoparms). Now duplicate this surface curve ("Edit Curves/Duplicate Surface Curves"), and the duplicate the new curve (Ctrl+D) two more times. By the end you should see three duplicated curves in your outliner, all exactly the same.

Now it's time to make your loft. The first curve is perfect where it is, but the second and third curves need to be resized. Make sure you center the pivots on all three curves ("Modify, Center Pivot"), and then scale the second curve to about 0.85 for all three dimensions, and scale the third curve to 0.001 for all three dimensions. This can be done in the channel box or the attribute editor. The reason that the third curve's scale is set to 0.001 is because we don't want to be able to see the hole inside of it.

Now select these surfaces in order in the outliner, from 1-3, holding shift. Now loft! ("Surfaces, Loft")

All of the duplicate curves created.
Lofted, from outside to inside.

Of course there's no dip in the surface yet, we haven't moved any of the curves downwards. But because there is still history on the loft, we can move those curves now and still have it affect our loft.

Fortunately, moving these curves does not have to be an exact art. You COULD research the equation to find the exact dip levels on the internet, or, you could guess it out. Try finessing the curves until you have a dip, and the dip doesn't look awkward. You shouldn't notice it from the top at all, but you should be able to see it from the side.

Good dip example.

How hide all of your curves and show all three pieces of geometry.


The l_glass shader has two areas of settings for it. The first is about what the surface looks like on the outside, and the second concerns what the surface looks like on the inside. It's actually quite simple to tell it those things, but first we have to make sure it knows outside from inside. It uses something called NORMALS. if you can master the normals, the l_glass shader is really simple to figure out.

Many people try the l_glass and give up, because it's not giving them their wanted results immediately. Well, many people forget to adjust the normals. I'm going to make it obscenely easy for you to remember which way normals should be facing.

Outer Glass - Normals facing OUTWARDS on the outside, INWARDS on the inside
Inner Glass (Liquid) - Normals facing INWARDS
Loft (Liquid Upper Surface) - Normals facing DOWNWARDS

If you're totally lost here, DON'T GIVE UP. It's really really simple to view and switch normals, all it takes is the click of a button.

Look at the guide: the loft normals should be facing downwards.
Ahh, that's better.

To view or hide the normals, select the object, then select from the menu "Display, NURBS Components, Normals (Shaded Mode)".

To switch the normals, select from the menu "Edit NURBS, Reverse Surface Direction".

Now, if you created everything the same as me, and you're using Maya 7, you don't need to switch any surface directions. I cannot promise that this will always apply, and you should double-check all of your normals before moving on. Once you have finished aligning your normals to the direction I mentioned above, hide your normals. It's now time to start shading!


You need two more things before you start shading: a light and an environment. Hopefully everyone here knows how to make a point-light to cast some light and checker-patterned box to hold your glass. Make those now if you need a makeshift environment.

You can render your scene to make sure those turned out all right. While you're at it make sure to CHANGE YOUR RENDERER TO MENTAL RAY. the L_glass shader can only be used in mental ray, and will be invisible in the Maya Software renderer. In the mental ray Render Globals, make sure that:

Anti-Aliasing is set to at least 0-2. Lower will make it unbearably grainy.
Reflection and Refraction under the "Raytracing" category are set to at least 8.
Max Trace Depth under the "Raytracing" category is at least 50.

Assuming that you've installed the l_glass shader by now, you need to assign a separate l_glass shader to each of your pieces of geometry. If you switch your menu to the "Rendering" menu, you can do this from the menu by selecting the objects, than selecting from the menu "Lighting/Shading, Assign New Material, L_Glass".

Let's take a look at what we having in our hypershade.

We have three l_glass shaders, each one assigned to a piece of geometry. I suggest you name each one after the piece of geometry that it's assigned to, to keep things simple. Now I will go over the l_glass shader attributes.

Color Filter - The color of the liquid, without factoring in refractions
Attenuation - Measures the thickness. Very useful for fine-tuning caustics.
Index of Refraction - A scientific term that describes how much light rays get bent by the surface.

These are the big three attributes for l_glass. The biggest one is the index of refraction. Here is a Wikipedia page that notes some common indices of refraction. The ones that we will need to know are water (1.33) and glass (1.50).

Let's start messing with out attributes here. I'm going to give you the indices of refraction for all of my surfaces.

Notice that every part associated with the liquid is given an index of 1.33, while every part associated with glass is given an index of 1.50. This will leave you with a perfect glass of water. Pretty cool, eh? Also note, another important attribute is accuracy. Never leave this below 5 for test renders and 8 for finals.

Now a water glass isn't exactly what I wanted. I was going for white wine. L_glass still has some bugs with color, so changing around your colors will be kind of a hassle. All I have to change are the big three attributes. Here are my final ones (for white wine).You may want to change your color depending on the surroundings, because the l_glass shader is easily affected by the environmental colors. Remember, the most accurate color isn't always the most realistic one.


Color Filter - H=240, S=0.005, V=0.996
Attenuation - 5
Index of Refraction - 1.50


Color Filter - H=240, S=0.005, V=0.996
Attenuation - 5
Index of Refraction - 1.50

Color Filter - H=57, S=0.040, V=1
Attenuation - 8
Index of Refraction - 1.35
Color Filter - H=57, S=0.035, V=1
Attenuation - 8
Level of Refraction - 1.35

Here is a the final render of the wineglass, and a simple cup of water, placed in an HDR-illuminated scene using final gather. The unrealistic shadow under the glass is the result of a physical light, which is being removed for the next render. The important thing is, the l_glass shader gave us a realistic result with a moderate render time and only a couple minutes of work!

Example of the l_glass shader