Quick Tip: Setting up an HDRI using Vray for Maya
In today's Quick-tip tutorial, Edgar Mihailov shows artists new to Maya, and/or it's relatively new Vray plugin, how to utilise High Dynamic Range Images (HDRIs) to illuminate your scenes, providing realistic reflections in the process. HDRI is now a standard across almost all rendering software and it's an extremely useful thing to learn how to use!
Hi everyone! In this tutorial I will be showing you how to first enable Global Illumination (GI) within your scene, and then we'll add an HDRi map using Vray for Maya. I will be using Maya 2011, but the process is extremely similar in some of the older versions of Maya (up to a point of course!) This tutorial is intended for people who are new to Vray itself, or just the Vray for Maya plugin.
I can't actually share the HDR image I use in the tutorial, however there are a reat many places on the web where you can download free HDRIs to use in your scenes (though please always be aware of commercial restrictions.) A great website for free HDRi maps is http://www.openfootage.net/, but I would advise you to buy at least one good HDRi map pack, as they are typically of higher quality and allow you to achieve the results below in your commercial projects.
For the purpose of this tutorial I made this very simple scene. It's essentially just a sphere, a plane for the floor, and a cross shape (which is nothing more than an extruded cube). Although simple, this will be more than enough to allow us to correctly set up our HDRI, and clearly see the results.
Before we can start we first have to make sure that the Vray plugin is loaded. To do this, click Window on the top menu bar, and then hover your cursor over Settings/Preferences and a menu will pop up. Once it's opened, choose the very bottom Plug-in Manager.
Maya's Plugin Manager menu will appear. Scroll all the way down to the bottom and make sure that vrayformaya.mll is checked as Loaded. If you do a lot of work with Vray, you might want to check Auto-load as well, which will make the plugin load up everytime Maya starts.
Note : If you don't see a vrayformaya.mll entry in the list, make sure you have installed the plugin correctly. If you reinstall the plugin, make sure you restart Maya before re-checking the Plugin Manager.
Now we have to switch our rendering engine to Vray. To do so, switch to the Rendering menu-set (by using the dropdown menu underneath the File and Edit menus on the top bar), then go to Render > Render Using > V-Ray.
Note: You can also see here the other renderers you have access to on the system. By default, Maya comes with Maya Software, Maya Hardware, Maya Vector and Mental Ray - all of which are covered heavily in the documentation.
After that is done we have to go in and set up our materials. Go to Window > Rendering Editors > Hypershade to open Maya's main material editor/creator.
In the image below you can see the Hypershade. On the right are the 3 existing material nodes in the scene, and on the left is a list of all of the material nodes you can create. We want to create a standard Vray material, so click twice where it says "VRay Mtl" to create two materials. As you do this, the new materials will pop up in the right hand side of the Hypershade. For this tutorial only these two materials will be needed.
Now double-click on one of the materials that we just created to open up the Attribute Editor. (This may appear as a floating panel, or docked to the right hand side of the main window.) In the Attribute Editor go to the Reflection section and change the Reflection Color to white by sliding the slider all the way to the right. This makes the material fully reflective - it is essentially now a mirror. We don't need to alter the other material as the standard settings will do for this test. Whilst I won't name the materials here, I strongly advise you to give each material a descriptive name if you're putting together a complex scene.
Note : If the Attribute Editor doesn't open, click once on your new material and hit CTRL+A to open it.
To apply our new materials to our objects, hover your cursor over the material in the right side of the Hypershade, hold down the middle mouse button, move your mouse over the object you want to apply your material to, and then release to apply it. Using this method, I applied our mirror material to the sphere object, and the other default grey material to the floor plane and the cross object.
Now we have to change our render settings and add in our HDRI. To do this, go to Window > Rendering Editors > Render Settings
We're now going to enable Global Illumination, a key part of making the HDRI work as it allows us to take into account any light coming from our environment within the scene. Switch to the Indirect Illumination tab and make sure that the first check box is turned on to enable GI. For this simple test I'll leave the rest of the settings at their default values, but you should feel free to experiment. For instance, the Primary Bounces Multiplier can be increased to brighten up a dark scene, which can be useful for some HDR images.
In order to use an HDRi map for our overall lighting, we have to switch to the VRay tab and tick Override Environment. If we were to do a test render now, the scene would be a light blue color instead of pitch black. That blue color is coming from the GI texture swatch as shown in the image below. This is where we're going to need to add in our HDRI.
Before we can do that however, we have to create a material for our HDRi map. So head back into the Hypershade (Window > Rendering Editors > Hypershade) and click the Textures tab as shown at 1 in the below image. We need to create a File texture to load in our HDRI, but it might not be easy to find in the list of available materials/textures. To speed up this process, type File into the search bar shown at 2 in the below image. This will quickly allow you to find a specific texture node. Once done, click once on the File node shown at 3 - it should appear in the right hand side of the Hypershade.
If you have stuff in your "Work Area", click the eraser icon to clear it.
Click once on the new File node to select it and hit CTRL+A to bring back the Attribute Editor. Once there, click on the folder icon next to Image Name and navigate to/select your HDRI map. It might take a while to load depending on the speed of your computer and size of the map.
Now open both the Render Settings window and the Hypershade window side-by-side. Just like when we applied the materials to our objects, we need to hover over the HDRI File node in the Hypershade, hold down the middle mouse button, move the mouse over to the black swatch next to Background Texture and then release. Maya will automatically add the File texture into this slot for us. We now need to repeat this process for the GI texture, Reflection texture and Refraction texture slots.
Note: Ideally you should use a low-res, slightly blurred version of your HDRI in the GI Texture slot, as it provides much smoother lighting throughout the scene. The 3 other slots should all use the high-res version.
You may notice that you can now see your image in the main viewport. If it looks as expected feel free to skip this step, however if your HDRi map is rotated sideways you may need to do the following...
Go back to the Render Settings, and in the Environment tab click where it says Edit UV Placement. As all of our maps are using the same file, altering one UV Placement affects all of the maps, however if you're using multiple maps you would need to repeat this fix for each one of them.
In the Attribute Editor, change the Vertical rotation from 0 to 90, which will rotate our image map 90 degrees, hopefully lining it up straight! If it's still not straight, feel free to change the number until it looks correct.
Our materials and HDRI are now all in place so it's time to render! From the top menu, go to Render > Render Current Frame.
Once completed, your render should look something like this. Now go and experiment with different HDRIs to see the wide range of results you can achieve! If you have any questions feel free to leave them below. Thanks!