Make Glass Effects With Maya Base Materials
Mental Ray for Maya
Today, I shared with you a tutorial about how to use the Maya basic material and the mental ray material to achieve the glass effect, I hope to help everyone.
The basic principle of materials: Law of Conservation of Energy
When light hits the surface of an object, there are three general reactions: absorption, reflection, and refraction. The reflection is divided into diffuse reflection and specular reflection.
According to the Law of Conservation of Energy, energy can not be disappear, only conversion can occur.
Reflected energy can be divided into diffuse reflection and specular reflection, while diffuse reflection is generally diffuse in our CG production process, while specular reflection is generally specular, and refraction is generally refraction. Let the incident energy be 100%, which is 1, and finally we can use the formula: 1>=diffuse+specular+refraction.
All reflections have a Fresnel Effect
The main factor determining the Fresnel Effect is the refractive index. When the refractive index is close to 1, the difference between the reflectance of the 90 degree angle of view and the 0 degree angle of view is larger. When the refractive index value is higher, the reflectance of the 90 degree angle of view and the 0 degree angle of view is closer to 1.
Generally, the refractive index of transparent objects is between 1.3 and 1.9, and plastic, rubber, and baking varnish are also around this range. The metal is 4-10.
Use **Maya** basic material to achieve glass effect
Here we use the blinn material that everyone is most familiar with and use the basic principles mentioned above to make the glass. This scene uses HDR for illumination, and in the Mental ray it uses IBL nodes.
The key settings are as follows:
Open the IBL node. If the FG does not open automatically, please turn it on manually.
Turn off the default lighting for the scene, at the end of the common tag.
Enable color management and set the following to turn on linear workflow.
The result of the rendering is as follows.
Give the model a blinn material and adjust the transparency to full transparency. Turn on the refraction under the raytracing option tab and adjust the refractive index to a value of 1.7 or similar to get the result shown below.
This is because the number of refractions is set very small by default, a simple scenario to illustrate.
A mirror with two opposite sides with a small ball in the middle. The mirror gives a highly reflective material.
Both mirrors give the same material, but the reflections in the opposite mirror are not, because the limits of the number of reflections and refractions are limited.
When rendering, if the computer calculates according to the display, it must calculate the reflection between the two mirrors infinitely. In order to avoid this, the software introduces the limit of reflection and refraction to improve the performance. There are raytracing, reflection, and refraction under the quality label of Mental ray. Their values correspond to the number of reflections and refractions that will be calculated, and max trace depth is the maximum limit of the sum of these two values.
Find the raytrace option for the blinn ball. There is a reflection limit below, which is also the limit on the number of reflections. You will find that this value is set to a few, then the reflection will be done several times.
The same is true for refraction. Generally, it is more than 9 times. The figure of the glass is adjusted after the number of refractions. The result is that the black place disappears, but the refraction is not good.
For glass objects, there is no diffuse reflection, and some are specular reflection and refraction. So, turn off color or diffuse first, and adjust the reflectivity and specular color to the highest. In the blinn material, the control of reflection is that when both reflectivity and specular color are 1, it is total reflection.
After adjusting the specular roll off to 0, the effect of this value is to control the Fresnel Effect. This value can be used instead of the sampler info and ramp nodes to implement Fresnel control.
The above image has the result of Fresnel Feflection, but the reflection of the cup perpendicular to the plane of your line of sight is almost invisible, and the value of eccentricity does not work. My blinn's transparency is all 1, the reflection is 0 on the 90 degree view, and the reflection is 1 on the 0 degree view.
I use a method to correct the refractive energy of different perspectives, that is, transparency. Here we use the classic method of sampler info plus ramp.
Insert the facingRatio of the sampler info into the vCoord of the ramp. Set the ramp end to the white end to be black. Insert this ramp into a lambert to render the cup.
This set of nodes can control different perspectives to get different values. The set of nodes just made is just right, inserted into the transparency channel of the previous blinn material.
Still feeling too dark, we can control the color on the ramp to adjust to acceptable results.
The bottom of the cup is especially black. This is because the lighting method I use is IBL, mainly relying on FG photons. The photon of FG is also reflected and refraction times. Turn on the FG's refraction limit and increase it a little, so that light can penetrate the wall of the cup to illuminate the ground at the bottom of the cup.
Finally, the ground texture is added, the intensity of the HDR is enhanced, the illumination is enhanced, and the material properties are finely adjusted to obtain the glass of the pure blinn material below. You can also add some color to the color of the ramp that is inserted into the transparency to create colored glass, but don't expect the result too much. It is also possible to add a little refracting blur to the glass.
For refraction blur, please select Mi Refraction Blur under the mental ray label of the material, limit is the number of times of refraction blur, and rays is precision. Increase the blur and create the effect of frosted glass. Of course, this property will slow down the rendering speed, please use it with caution. You can also attach a texture to the bump to make the glass look less regular.
Making glass with **mental** **ray** material
Mental ray's architectural materials have many advantages. Compared to blinn, there is a huge optimization - built-in energy conservation. Even if there is a problem with the settings, the result is still a forced result, which is different from the setting. When you give the material a color, then constantly adjust its reflectivity and you will understand.
The mia material is set so that the reflectance of the 0 degree angle of view and the 90 degree angle of view is 1, that is, no Fresnel reflection is generated, and the default mia has Fresnel reflection. The following are the effects of Reflecity=0, 0.3, 0.6 and 1 respectively.
When the reflection of the mia material is turned to 1 and the Fresnel Reflection is turned off, it is the mirror, which perfectly reflects the surrounding environment without itself. Then adjust the reflectance to 1, the refractive index is adjusted to 1.7, the transparency is adjusted to 1, that is, fully transparent, open the brdf shutter, check the use fresnel reflection, this option will let the refractive index control the Fresnel reflection. And the larger the max distance, the lighter the glass color, and the smaller the max distance, the darker the glass color.
Shadow of glass and caustics
The shadow of the glass is the first thing to be clear: the shadow of the glass is solid and opaque! Blinn material, shadow attenuation under raytracing options, the smaller the value, the more transparent the shadow, the larger the value, the more opaque the shadow.
The mia material also has a shadow calculation similar to blinn, and when max distance is used, your shadow method must be segments to get the correct shadow effect.
Now use the mia material, then pay attention to the refractive caustic and transparent shadow options under the advanced refraction, and want to use the caustics shadow, so check the former, and adjust the photon and so on to enhance the caustics.
This gives a good caustics effect, which is the effect of making glass using Maya's basic material.
Author: Dai Wei