Getting Familiar with mental ray in Maya

Rendering is a vital part of any 3D production and having a solid understanding of the tools at your disposal and how they work is a crucial step in creating amazing renders for any project. One of the most popular renderers you can find built in to the most common 3D applications like Maya, 3ds Max and more is mental ray. Whether you need to simulate realistic indirect lighting effects, create convincing real-world materials or incorporate motion blur into an animation, mental ray has those capabilities and more. Making sense of all the tools in mental ray can be a challenge. This article will cover some of the core features of this powerful render engine so you can begin creating high quality renders in a shorter amount of time.

What is mental ray?

mental ray is used to achieve high quality effects that typically cannot be found in some of the default render engines in programs like Maya and 3ds Max. There is a standalone version of mental ray that can be purchased but it comes fully integrated into a lot of the Autodesk applications like Softimage, 3ds Max and Maya. Using advanced ray tracing techniques the mental ray engine is able to create high quality renders utilizing final gather, global illumination and caustics to create convincing real-world lighting effects. mental ray has been utilized in many different film productions including Spider-Man 3, and TRON: Legacy.

Understanding Object Scale

When rendering in mental ray one very important thing you need to keep in mind is your object scale. mental ray is designed to mimic what you see in the real world, because of this it's key that you keep real world scale in mind when rendering. You'll be able to get more realistic and predictable results when rendering. As you're modeling or working with models it's hard to really tell exactly how large an object is in 3D space. What can seem very large may actually be tiny in size or vise versa. By default Maya works in a centimeter scale, so one way you can begin to get an idea of how large your object is, is to compare it to the grid in the viewport.

The smaller character is actually the normal size of a real person.

The smaller character is actually the normal size of a real person.

For example, if you have a character that you assume would be the size of a normal human and compare it to the grid below you may start to notice that the grid is hardly visible. This means that what you thought was a normal sized character is actually a giant. The opposite can also happen, the object or character may take up only one small grid square, this means that the character is actually about the size of a small BB in real world scale.

This can start to create unexpected results when rendering, so to avoid this make sure you’re resizing your objects to real world scale. If you want a character to be six feet tall make sure that is actually how tall they are in 3D space. You can do this by using the measure tool inside your 3D application. In Maya this tool is located in the Create menu.

Rendering with Global Illumination

One of the vital features of mental ray is global illumination (GI), which is a way to simulate indirect lighting effects in a render. Light in the real world bounces around and is reflected off objects, the color of these objects get passed around to different areas. For example, if you there is a bright red wall some of the red color is going to bleed onto the floor and ceiling and any other objects in the room.

To learn more about GI read this in-depth article.

You also want to ensure the Raytracing box is checked. This allows you to turn on the other secondary effects.

You also want to ensure the Raytracing box is checked. This allows you to turn on the other secondary effects.

You can enable global illumination in the Features tab of the Render Settings window in Maya. However, when this feature is enabled in the render settings of mental ray it actually won’t have a change in your render. Global illumination works by sending out photons to sample the environment from the actual light source, so you’ll also need to emit photons from the light source.

To do this select your light source and go into the attribute editor and check the Emit Photons box. This will enable the light source to emit photons.

A very important thing to keep in mind is that the photons being emitted from the light source are based off the principles of real world light, so if a photon leaves the light source it looses its energy as it travels further through space. Because global illumination works in this way it’s vital that you ensure you’re scene is set up in a real world scale. As mentioned previously.

One key attribute you want to keep in mind is the photon intensity, and this can be found in the light sources Caustic and Global Illumination settings. With the default intensity you may hardly tell a difference when you render, depending on the size of your scene. Increasing the photon intensity it will actually increase the overall effect the photons have in your scene, making the indirect lighting in the scene much more powerful as you can see in the image below.

Using global illumination often produces very splotchy results. You could try to increase the amount of photons in the scene, but even then it may not produce the results you want. While global illumination is vital for simulating real world lighting effects you will actually want to use it in conjunction with final gather to get the best possible results.

Rendering with Final Gather

Final gather (FG) is sort of the faked method for simulating indirect illumination. However, when used in conjunction with global illumination you can get some great results and it’s actually a little simpler to understand and use than GI.

If you want to learn how final gather works read the Understanding Final Gather article.

As you may have found out, you can get some very splotchy results when working with global illumination. You can try to increase the amount of photons cast, but this can increase render time drastically. Final gather is used to smooth out the results producing nice blending and soft shadows.

You can enable final gather the same way you did with global illumination by going to the features tab in the render settings and checking the final gather box. However, final gather rays don’t need to emit from a light source so once it’s enabled it will begin calculating when you render.

With final gather enabled it helps to smooth out the splotchy areas caused by global illumination

With final gather enabled it helps to smooth out the splotchy areas caused by global illumination

As you can see from the image above, the render on the left only had global illumination and because of this the results were very splotchy. When final gather is enabled it creates much smoother results.

If you go back into the render settings you can increase the accuracy of final gather which basically increases the quality. Of course, this will bump up the render time the higher this value is. You can also increase the Point Density and Point Interpolation to smooth out the final render.

Using Image-Based Lighting

image based render

With mental ray you also have the option to use an image based lighting setup which takes a high dynamic range image and mapping it to a sphere. This real world image is then used to simulate the lighting for the scene. This method is great for quickly getting realistic results in a short amount of time.

You can find image based lighting under the Indirect Lighting tab of the render settings. When you create an image based light a dome is placed around your scene, this is what the HDR image gets mapped to.

In the attribute editor of the image based lighting you have the option to map an image to the dome if you wanted to use an image to light your scene.

Clicking on the folder icon will allow you to browse to where your saved HDR images are located.

Clicking on the folder icon will allow you to browse to where your saved HDR images are located.

You also have the option to use a texture, like a simple ramp to simulate the sky. Of course, this does not produce extremely accurate results but it’s a very quick way to light a scene. One important thing you need to keep in mind when using image based lighting is that you need to enable final gather in order to calculate the image’s lighting into scene.

Adjusting the Quality of a Render

In the Quality tab of the render settings you’ll find a lot of different sampling modes and other attributes that can be adjusted. In Maya 2014 the unified sampling mode was introduced and is an easier way to increase the overall image quality.

Remember that the higher the sampling quality is, the longer it will take to render.

Remember that the higher the sampling quality is, the longer it will take to render.

By increasing the quality of the unified sampling mode it will begin to smooth the render out and eliminate some of the noise and artifacts that often appear in a render. There is a point when increasing the quality doesn’t have an affect on the render, if this occurs you can begin to up the max samples per pixel.

mental ray is an extremely powerful render engine that has the capabilities of producing high quality renders. As a 3D artist using Maya is something you need to become familiar with. This article really just scratched the surface of the capabilities of mental ray, if you want to learn even more check out Introduction to mental ray in Maya.