For this demo we will utilize Maya's Blinn material, Ramp texture, and Sampler Info utility. We will also use Mental Ray's Dielectric Material and new Mia_material. The user of this tutorial should note that I have also used Mental Ray as my renderer, with Final Gathering, Global Illumination, Caustics, and Image Based lighting used for optimal realism.
Creating Glass with a Blinn
Our first step is to create the geometry for the glasses. Whilst simple, we need to make sure that the revolved surface (constructed here using a NURBS) is thicker at the base (just like a real pint glass). See Fig.01.
Next, I duplicate out a few of these, and set up the scene. My render settings are listed here as well (Fig.02 – 03).
Understanding What Goes into Glass
There are several components which need to be created. The first thing to note is that, of course, glass is a transparent entity. While this is the most obvious, we cannot overlook the subtleties inherent in this transparency due to the thickness of the surface as perceived. Second, glass is reflective, but again we must examine how this reflectivity works. It is a specularized surface, and thusly not very diffuse in terms of surface properties. Finally, glass is a refractive surface, bending light as it enters this medium which is denser than the air around it. Let's break these elements down for a closer look:
– As mentioned, glass is transparent. But let's examine what happens to our material as it gets close to the edge ... It gets thicker. At the edges of the glass we are actually looking through a denser amount of material. Think about it this way: when a space shuttle exits the atmosphere by flying straight up (off the perpendicular normal of the Earth) it only goes through 62 miles of air to reach outer space. Conversely, if you were standing on the top of Mount Everest and could look both north and south from the summit, you might be able to see 150 miles in each direction (a total of 300 miles) before the Earth curves away and you are looking into space. When we look at the edge of the glass, the same thing is true, therefore we are looking at more "object" and should treat these edges as less transparent (Fig.04).
– Applying the same principle as before, that things are going to act oddly at the edge of our glass, we next throw into the mix the Fresnel Effect. When you look down at a reflective surface, the amount of reflection is determined by the viewing angle. If you were to look straight down into a pool of water, you would be able to see through the minimal reflectivity of the surface to the elements in the water below. At a more even angle, looking across the water, you are more likely to see reflection of the sky above, and not what is underneath. So, when texturing our reflectivity, we will also have to examine these edge effects to make our glass more reflective at glancing normals, and less reflective at normals which point directly towards the camera.
Specularity (vs. Diffuse)
– We must also observe where on the spectrum for Diffuse to Reflective our glass needs to be. For the most part, since it is a dense, hard object, we will need to give it a low diffuse value and a higher specular value. We can then control glossiness depending on the purity of the glass, or whether or not the glass is "frosted".
– Finally, since our glass is a denser medium than the surrounding air, we will need to compute the index of refraction value. A chart is listed for your convenience in Fig.05. We can quickly see that Glass's IOR value is 1.52 (or really any value between 1.5 and 1.55). As seen in Fig.06 – 07, when a beam of light enters a denser medium, it bends towards the normal of that surface, changing the perceived shape of objects inside or behind. The famous example can be seen on the left, this is called the "stick in the pond" example, theorized first by Socrates. The straw is not really bent, but the fact that we see it through a glass, with water inside that glass, means that light is bending twice between the straw and the eye. This concept has a name: Dielectrics (hence the specialized Dielectric shader that we will use soon).