• home
  • forum
  • my
  • kt
  • download
  • The L_Glass Shader

    Author: 2007-06-23 15:30:10 From:

    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.


    Modeling:

    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.


    Unrevolved.
    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.


    Undetached.
    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.