You are on page 1of 20

Quick Start Mental Ray for Maya with focus on Caustics, Final Gather, Global Illumination, Shadows, and

settings for memory management. Tutorial by Robert Cole, http://www.texturelighting.com Caustics Global Illum (radiance) Final gather ( diffuse lighting) Shadows Setup and Tuning Mental Ray Misc tips and resources.

Setting up MR in Maya: Make sure the plugin is loaded: Window>Settings/Preferences>Plugin Manager.

1.Click on Render>Render using>Mental Ray 2.Create 1 each sphere, plane, spotlight.

3. Render>Render Current Frame.

4. In the Render View window, select Options>Render Globals>(mental ray)

At the Format and Resolution box change it to NTSC. At the Quality tab change it to Production When you click on these tabs and change settings, new tabs will appear behind the main Render Globals window. Clicking on the symbol will bring you to the tab to adjust those settings, but note that if you have previously made changes to that tab, the settings in that window are re-set. I suggest that you may want to select the window(s) from the tabs at the top of the Global window.

At Frame Extension make padding/name/extension changes when you wish to render an animation, but for this tutorial leave at defaults. At the Memory and Performance tab, choose BSP, leave at defaults for this tutorial. Geek Stuff about BSP and tuning the renders for better performance: Binary Space Partition Parameters ..what the heck is that? BSP is the way MR partitions a scene in memory to grab chunks of the scene geometry, break it down into useable pieces, process it, and go to the next chunk. So, the BSP SIZE is the number of triangles per scene voxel MR will process, and the BSP DEPTH is the maximum number of times MR will subdivide to get to this depth. So, I have found over the years that a setting of 4,5,or 6 works best for the SIZE, and for the DEPTH, a setting of 25 for light geometry scenes, 40 for medium, and as high as 55 for heavy scenes works best. Do not go over a setting of 60 or performance will take a hit. See the excellent book Rendering With Mental Ray by Th. Driemeyer for more information. I understand the 2 nd edition has a cd with a demo of MR V2.1 on it.! In the Memory and Performance box you can also select Grid This is a setting that you may only want to choose if memory management is a problem with very heavy scenes, but with RAM being so cheap these days, and use of the imf-copy utility, you may never need Grid. (more on imf copy later). Ok, back at the Render Globals main screen, leave the rest of the settings at their defaults, (MR will manage Virtual and Physical Memory at the default settings just fine) next choose the NTSC tab to view the settings, you may leave at the defaults for this tutorial, but here is where you would choose one of the 28 output formats and 16 data flavors MR is capable of.

Next choose the Production tab, this is where you will be coming back to make changes when tuning you final renders. If by chance you were to choose Preview or other tabs at the Quality box at the Render Globals main tab, a different tab would be in this position and you can make the necessary changes to parameters there. Set-up the Production tab as follows: (Continue to next page)

In the Rendering box you will want ray tracing, but at these low values for this simple scene.

Scanline will do just what it says (like Maya) it will scanline parts of the scene that dont need raytracing. Faces will tell MR to render back or front or all faces. A very useful option. Shadows for this release of MR for Maya, choose segments. This method is similar to Ray Marching algorithms, a topic I will cover in a later tutorial. Check rebuild shadow maps. One of the great aspects of MR is that you can do simple shadows with hardware if your video card supports at least a 24 bit Z-buffer. The drawback is that there will be no oversampling or motion blur. Caustics.. leave at defaults. Global Illumination.. leave off for now. Volume Caustics not fully implemented yet in this release. Reflection/Refraction Photons.. set to same values as raytracing for now. Photon Map File: the photon map, which is an addition to the diffuse output of the final render, needs to be rebuilt each time you make adjustments. The map can be stored anywhere you like on your drive(s) with the extension .pmap. Sizes range from 1 Mb on up, and no, there is no viewer for them except in a MR render. Final Gather leave off for now. Sampling Quality.. do not go under 0.050! 0.10 is fine also. Guass Filter is very nice, do not go below 2.0 Jitterreduces banding problems, I always have it on. Done with the MR render Globals, minimize the render view and select the sphere and go to the spheres Transform node and in its attribute editor, set : (continue to next page)

You will need to un-check Derive from Maya to access these settings. (These settings only apply to how MR will handle the geometry)

Select the plane and in the Transform node of its attribute Editor, set:

Select the Light, and set:

If you will want complete physical accuracy for your light and Photons, you will have to change the light to Quadratic decay and check the Physical box under the Photons. The Exponent box refers to the decay rate of the energy of the photons, which for complete physical accuracy should be set to 2, which is quadratic decay. Setting to a lower value increases the decay rate, which is a bit counter-intuitive.

Notice the Global Illumination box is not active: You must turn this process on in the MR Render Globals>Production> Caustics tab to make it active. Now assign shaders to the geometry. Create two (2) Blinn shaders, assign one each to the Plane and the Sphere. Even though you may want a Lambert type look to the plane, you need a reflectance attribute in the shader so it can participate in Globillum. Set the shader for the Plane:

Set the shader for the sphere: (see next page)

Go to your render window, ( it may still be minimized, if not bring it back with Render>Render Current Frame) and in the Render View window click Render>Render Current. Make sure you have framed up the sphere and plane in the perspective window. Viola! Caustics! Now, if you want to improve/alter the caustic quality, play with the accuracy settings in the Production tab before adding more Photons from the light attribute editor. If nothing is showing up also try adjusting the energy boxes upwards. The energy settings refer to RGB values, so for example an energy setting of 5, 5, 10000 will give a nice bright blue caustic. Note: Also, if the image is still at 320 x 240, go to Maya Render Globals and set to 061/NTSC, and this should give you the 720 x 486 format.

Next open up the MR Render Globals tab again and enable Global Illumination, turn off Caustics, give the shader for the Plane a strong color (red, perhaps), turn off the transparency of the Sphere shader, turn the eccentricity values in both shaders to 0, rolloff to 1. Duplicate the sphere, move it next to the first sphere, and duplicate the shading network and assign it to the new sphere, change the color and reflected colors. Check your light to make sure it will be emitting GI Photons, increase the energy(s) to 50000, Photons to 30000, check the physical box, and render. You should get:

NextFinal Gathering

In MR Render Globals, turn off Caustics, turn on Global Illumination, turn on Final Gathering, Turn spotlight intensity to 0, turn on physical add Photons and increase the energy until you begin to get an nice(?)image.

In larger scenes, it will not be unusual to increase Photon count to 1000000 and energy levels to same or more. Increasing energy will not increase render times, but adding Photons will. Again, it is always better to adjust Accuracy and Energy before adding Photons. Photons are emitted from a light even with 0 intensity, and unlike 3D/CG light they trace a path from the Light to the objects in the scene. 3D/CG light is actually traced from the camera to

the geometry and then to the light source. Understanding that Photons are not Illumination is essential. Next: IMF Copy the imf-copy (see your documentation for use) will greatly reduce render times with scenes that use file textures. It is similar to creating BOT files, in that only the parts of the texture file that are visible in the render are called. There are some nifty options (elliptical filtering, etc.) with imf-copy that will pre-filter the file. I will be doing a HDRI tutorial later, as it is all the rage now, but for now here are some resources for HDRI and MR: Mental Ray discussion at Mental Images Demo Version of MR 2.1 with book Rendering Demo Version of MR 3.1 with book Programming http://www.pixho.com http://www.bullerin.com/ http://www.debevec.org/HDRShop/ www.edharriss.com (hdritoxsi utility) http://www.finalgathering.com Tips: GlobalIllum and Final Gathering will look best when you reduce the Diffuse component of your shaders, as the Photon map is adding to the Diffuse component. Some samples of my recent experiments, with the reference image displayed first.

continue

continue

end. Robert@texturelighting.com

You might also like