Ok, so now that we have a handle on the physics that goes into this, we can make these materials. Let's start out by trying to accomplish the look of true glass using a Maya Blinn. I will first make the colour and diffuse colour very dark so as not to influence the look of the glass at all. The transparency is set pretty high (although we will texture this in a few moments). The Eccentricity is low and the Specular Roll off is high, creating a highly specularized (less glossy) look. The reflectivity will be textured in a few moments as well (Fig.08). Note: I do not have the Reflected Colour Channel textured since I have actual objects surrounding this in the pint glass in the scene. If the glass was on its own, it would need an image to reflect, and we would place that here.
It looks so bad in Fig.09, mostly because of the lack of refractivity. So reflectivity is what we will establish next.
Ok, let's get the refractivity working! (Fig.10)
It's looking better now (Fig.11), but the glass is still too uniform in its thickness and reflectivity. Time to add some ramps to control this!
– let's first add a ramp to control Transparency. We will control this ramp using Maya's Sampler Info node. First I will create a ramp texture and link it to control the transparency of the glass. The ramp is black-to-white, as it only controls alpha information. Whiter is more transparent; blacker is more opaque (Fig.12).
This will (by default) apply the ramp directly to the UVs. However, since this is a V-Ramp (as seen in Fig.12), we can use the Sampler Info Utility's facing ratio attribute to control this V-Coordinate. This will cause the ramp to be applied based on how much the normals of the glass face the camera. The top of the ramp will now represent where the object's normals are facing the camera; the bottom will represent the angle which is facing 90 degrees away from the camera. We can then perform yet another render (Fig.13 – 14).
We're getting there! Now let's establish the reflectivity that comes with the Fresnel effect.
The Fresnel Effect – we need to establish another connection of ramps to the reflectivity channel. Also known as the "Bidirectional Reflectance Distribution Function", our goal is to establish a ramp to correspond values of how reflective the object will be when we look at the mesh from a low angle, and correspondingly from a high angle. When established, the ramps should looks as shown in Fig.15.
Our hypergraph network should look as shown in Fig.16 (note: I have re-used the sampler info node). Here is our render (Fig.17).
Lastly, let's add some blurring for a touch more realism. With Mental Ray we can subtly blur our reflections and refractions (Fig.18 – 19).
Done! We have now successfully created glass using a Blinn. Let's now examine how Mental Ray can do this much more simply.
Creating Glass with a Dielectric Material
I have now made a second pint glass and created a Mental Ray Dielectric Material to apply to it (Fig.20). The attribute editor only has a few choices; this is because all of that sampler info and ramp stuff that we had to do with the Blinn is already taken care of. The material's attributes are a hard specular/reflective surface by default, and all we have to do is set the IOR value to that of glass. The IOR_out value is also crucially important and represents the value of the medium surrounding the glass (in this case air). A situation where this might need to be altered is when we are creating a material for water that is in a plastic water bottle. IOR would be set to 1.33 for water and the IOR_out would be set to 1.46 for the plastic surrounding it. Here we see a render as well (Fig.21 – 22).