Deep OpenEXR files allow to store a variable number of samples per pixel at different depth locations to aid advanced depth compositing workflows.
To render a Deep OpenEXR file with mental ray, open the Render Settings dialog and make sure that the image output format is set to “exr” in the Common tab:
In the Scene tab, enable the “Use Deep Image format” checkbox:
The Deep OpenEXR file is written in multi-part, which means that files can contain a number of separate but related images. Each render pass gets its own part (i. e. direct_diffuse, indirect_diffuse).
In order to save memory during rendering, mental ray creates tiled Deep OpenEXR files. These files need to be converted to scanline for use in compositing applications like Nuke. This conversion can be performed using imf_copy, a command line tool that is part of your mental ray for Maya installation. It can be found in the bin directory. Call
mental ray for Maya 2016 SP2 is now available for download here or it is automatically installed by the Autodesk Application Manager.
It ships with mental ray 126.96.36.199 which contains improvements for the BSP2 acceleration structure in certain cases, bug fixes for multi-host rendering and for some framebuffer handling issues. The release notes provide more details.
Several bugs were fixed in the mental ray for Maya translator, notably concerning undo when modifying simple mila_material parameters, satellite rendering issues, and a workflow improvement with regard to the new Create->Lights menu and Environment lights.
possible issues with semi-transparent objects in segmented/sorted shadow modes
possible tile artifacts in particular with glossy reflection mix
VP2 display for mila is now also working for scenes created with Maya 2015
UV-tiling: There was a severe bug around uv-tiled textures and conversion to .map textures: the conversion to .map would sometimes be automatically triggered. This is fixed now. The conversion will only occur if ‘Use optimized textures (auto-conversion)’ is checked in the rendering preferences. (There is a known issue in this context: the button ‘Update optimized cache textures now’ only converts the first uv-tile of a uv-tile sequence. The others will be converted during the first rendering.)
Also, when you created two file texture nodes both referencing the same uv-tile sequence, this could lead to a crash with the previous version. This is now resolved.
There are also various performance improvements in the SP1 version:
Since Maya2016, the new shadow mode default is “shadow segments”. This mode supports all ray tracing effects including subsurface and volume scattering in contrast to the approximate, thus potentially faster “simple” shadows. With the latest mental ray, we have improved the performance of “shadow segments” on scenes with extremely high depth complexity.
Light Importance Sampling is now faster for scenes with a mixture of large and small are lights.
Mental ray render times with procedural shaders/textures (ocean, fractal, and so forth) are also improved.
In this second post in a series on mental ray for Maya 2016 Render Settings, we assume you are familiar with the concepts presented in the introductory post.
Adjusting Overall Quality
Overall quality is the primary control for adjusting quality vs. speed. When there is noise in the scene, typically increase this quality.
In our example scene below, we set Overall Quality to an extremely low 0.01. Please note the edge aliasing on the tops of the spiral cone object. The back wall also has a bump texture which has noise at this quality setting.
In the following images we increase the overall quality from 0.2 to 1.0 by 0.4. Note the better anti-aliasing at the edges of these objects, in particular.
To visualize how eye ray samples were placed in the rendered image, from the Diagnostic tab check Diagnose Samples before rendering. With this checked, each render creates special informational passes for diagnostics including samples, error, and time per pixel. To view it, from the Render View File menu in Load Render Pass, choose the Diagnose samples pass.
This will bring up an imf_disp window with the samples pass already tone-mapped to see the sample density in gray scale clearly.
Note the green arrow above pointing out useful information in the bottom bar. Wherever you locate the cursor on the image, in this bar you will see the pixel location, [202 48], and the number of samples, 15 in this case.
Here are a set of samples diagnostics to match the increasing quality from our scene above from 0.2 to 1.0. Whiter areas have more samples.
Balancing Quality Adjustment
Although Overall Quality can be used to handle most quality vs. speed adjustment, we can provide understanding how to get to desired results more efficiently. Understanding is important to prevent artists from quick fixes that turn out to take longer than originally planned.
With that said, it is possible to balance the local vs. the global quality settings for faster renders. This balance will evolve as machine resources change and rendering technology adapts. For example, a brute force render running on GPU might rely solely on a global quality control, since pure path tracers do not split eye rays by design. However, current mental ray provides flexibility in how much you want to tip this balance one way or the other. It can evolve at your pace, and fit your CPU and GPU resources as they evolve.
Use the localquality controls when there is an unbalanced amount of noise from lighting or from materials. For example, if the direct lighting appears to create more noise than other aspects of the scene, increase the lighting quality for optimum speed vs. quality tradeoff. Once adjusted, the overall quality can be used as the main control again.
Consider lighting quality adjustment when the lighting has a large variation. For example, when using a large (> 40) number of lights, or several large area lights. Or when using a high resolution, highly varying HDR image for your light texture. For example, below we have one rectangular area light showing its HDR texture clearly as not uniform. Its range reaches up to values of 70 in a thin horizontal line in the middle of the thick one you see at this exposure. It required less light intensity as well as high lighting quality.
Consider indirect diffuse or material quality adjustment when noise appears on indirectly lit diffuse or glossy surfaces. Or on surfaces with a lot of geometric detail. If you ever had to work with an ambient occlusion (AO) pass that needed more samples, you have a rough idea of the kind of look difference due to geometric variation. The surface details can come out a bit more clearly, with less noise.
Adjusting Lighting Quality
The Lighting Quality controls the number of direct light samples used, when a ray hits an object. It takes into account the number of lights, both point and area, and other factors to determine how many light samples to use.
The scene used for our example has 14 area lights with sphere shapes. Note the quality of the direct lighting on the floor as we increase lighting quality. In this series, we keep Overall Quality at 0.25 and increase Lighting Quality from 0.2 to 1.0 by 0.4 steps.
When using Lighting Quality in the new UI, mental ray overrides the explicit area light samples set in each area light with a global samples-per-light setting. (Currently, it does not gray out the samples settings in the area light AE UI). The total number of light samples are re-allocated based on importance. For example, more samples may be taken from closer, or higher intensity, lights.
Tip: If you are having difficulty isolating the visual noise for adjusting direct lighting quality, use MILA light passes to help you see it. In the Scene tab, enable the direct diffuse pass and adjust to minimize noise in that pass, compared to other passes or the beauty itself.
For example, the following images show the direct diffuse pass from the above renders, as Lighting Quality increases from 0.2 to 1.0 by 0.4 steps.
We will show more detail about light passes in our upcoming post on light passes.
Environment Lighting Quality
Controls the number of environment light samples to use. Also using importance, it is separate from lighting quality and enabled when environment lighting is enabled. We will give examples of this in a later post in this series about environment lights.
Adjusting Indirect Diffuse (GI) Quality
We encourage the selection of On (GI Prototype) mode, over Finalgathering and other legacy modes, for its reduced controls and higher quality. When On, mental ray uses a new technique to characterize arbitrary material shaders, while also providing non-interpolated brute force sampling paths for ease-of-use.
The Indirect Diffuse Quality controls the number of samples split out for a diffuse interaction at a material. For the basic default Global Illumination (GI) mode of On, this controls the number of GI rays. In Finalgather (FG) mode, it controls the number of FG rays, as well as the FG point density and other FG controls.
Below as Indirect Diffuse Quality is increased, note the noise on the floor where the light has to reach from reflections off the walls, ceiling and objects.
To see it isolated as we did above with the direct diffuse pass, enable the indirect diffuse pass.
Diffuse Trace Depth
The Trace Depth controls affect how deep an individual eye sample path can go. The Indirect Diffuse trace depth has moved into the general Trace Depth section. When an eye sample originates from the eye, each interaction along a given path increases the ray traced depth count. The interaction type can identify different types of counts. For example, a Diffuse reflection or transmission counts toward the Diffuse depth, while glossy or specular reflection counts toward Reflection, and glossy or specular transmission counts toward Refraction.
Note: Currently, a Diffuse value of 0 means that the first indirect diffuse samples are taken, but then no others, when an indirect diffuse mode is enabled. In other words, the act of using an indirect diffuse mode automatically creates the first level in trace depth. However, this diffuse count starts after the first diffuse interaction, not at the eye. Compared to the rest of the depths, this means this number is one less in relative depth to the other interactions for a given eye sample. This matches legacy FG diffuse depth control. But this will be changed in the future to better match the other trace depth controls.
Material Quality is discussed in more detail in the next post on recommended modern materials and lights.
In Maya 2016 we are introducing basic support for loading and rendering MDL materials with mental ray. In this post we want to take a closer look at how these materials can be used in Maya. For a general introduction to MDL in mental ray, check out this post.
The MDL Node
In Maya, MDL materials are represented by a new surface shader node called mdl_material, which is located in the mental ray surface material section of the “Create Material” window or “Hypershade”.
When you assign an mdl_material to an object, you will see that it contains two drop down lists: One for choosing an MDL module and another one for choosing an MDL material:
An MDL module is a file which can contain one or more MDL materials and has a “.mdl” extension. By default, mental ray for Maya 2016 ships only one module, that contains the default_material, a light grey diffuse. Because of that, both drop down lists contain just one entry.
To populate the lists you will need more materials. In the next section, we will see how to get some.
Adding MDL materials
As already announced in the MDL introduction post, example materials can be downloaded here.
1) Unzip the archive to a temporary directory.
By default, mental ray for Maya uses one root directory for placing MDL modules, the directory shaders/mdl within your mentalrayForMaya2016 installation.
2) Copy the folder mdl_examples_for_maya_3dsmax into the MDL root directory as shown below:
If you do not have write permissions in the Program Files directory or would generally prefer another location, you can define additional MDL root directories by specifying the MI_MDL_PATH. To do so, open the Maya.env file, which can be found in the Maya 2016 user directory:
Add the line
MI_MDL_PATH=<Path to MDL files>
If you, for example, make an MDL root directory called “mdl” in your Maya/2016 user directory, as shown in the screenshot above, your MI_MDL_PATH path needs to look like
More than one path can be specified, separated by a “;”.
A note on packages
In most cases, MDL modules are organized into packages, just like our example package. On disk, a package corresponds to a directory. The name of the package is the name of the directory. Packages can be nested to organize complex libraries. Within a package, modules can reference each other and contained resources (like textures) relative to each other or the package root directory. Because of this, it is important to always retain the package structure. Never just copy single mdl files or subdirectories out of a package into your MDL root directory, always use the full package, including the root folder.
Rendering MDL materials with mental ray for Maya
Now that our example package has been put into place, start Maya. Create an object and assign a mdl_material to it. The MDL Module drop down list should look like this:
When you choose a module, the material drop down list will be populated with the materials contained in the selected module, and the first material will automatically be selected. The “MDL Material Parameters” section shows the parameters of that material, which you can modify to your liking.
Other MDL materials, focused on requirements from the automotive industry are available for download in the Advanced Rendering Forum.
MDL materials are closed entities. They cannot be used in a shading network. Even though Maya allows connections to traditional shader and utility nodes, mental ray will ignore these connections. However, MDL materials can be used alongside with traditional materials and shaders.
In its initial state, the mdl_material node does not come with a swatch render, has no viewport representation and is also not supposed to work with IPR. These limitations will be removed in future releases.
NVIDIA Material Definition Language, in short MDL, is an NVIDIA initiative to standardize physically based material designs in a common format, see www.nvidia.com/MDL. MDL materials can be shared across renderers which are able to handle physical material properties like BSDFs in their core. mental ray 3.13 offers support for rendering pre-packaged MDL materials. In this post, we provide links to resources for MDL and give some background. In the following posts, we give instructions on how to use the materials in 3ds Max and Maya and provide example MDL materials.
The Material Definition Language Handbook gives an in-depth introduction to MDL and is aimed at the technically interested reader to learn more about the concepts of MDL and the ideas behind it. It’s work in progress and you will see it evolving over time. In the MDL developer section, you will find the MDL Technical Introduction and the MDL 1.1 Specification among other information.
In this first version of MDL in mental ray, the user should expect some restrictions that we will remove going forward. Editing MDL materials is currently only possible on a parameter level after loading external MDL code through the mechanism that we describe below. Both MDL materials and traditional shaders can be utilized side by side within the same scene and will render smoothly. However, MDL materials are closed entities for mental ray upon loading. Parameter connections to other shaders or other MDL materials are currently not supported. Measured materials and the emissive properties of MDL are not yet handled by mental ray 3.13.
We are providing some MDL material examples in the subsequent posts that showcase the power of MDL for rendering complex shading and lighting effects. Please follow closely the instructions on how to install the examples for rendering within your application.
This is the first in a series of posts on mental ray for Maya 2016 Render Settings
We significantly changed the mental ray for Maya 2016 Render Settings User Interface (UI) in order to reduce time spent adjusting renders. The defaults aim for no-fuss rendering of the most frequently used and up-to-date features. Of specific note, our newest Global Illumination (GI) mode significantly increases ease-of-use and productivity.
We provide almost everything a user needs here within this UI. For example, a user should not have to type in string options anymore.
Members of both NVIDIA ARC and Autodesk, including UI designers and developers, collaborated to make this change significant. As stated in the Maya 2016 documentation for mental ray Render Settings, we aim to:
Enable complete rendering without requirement to adjust or enable most settings. The defaults should enable the most frequently used features.
Increase ease-of-use when adjusting settings to control for optimization and quality.
Provide single global controls to reduce repetitive and potentially error-inducing settings across scene elements.
We also want to retain the flexibility of mental ray for production users. So we provide an Advanced Settings option on each of the new tabs. We hide less frequently used features in favor of a cleaner, more productive and simpler control for basic workflow. This leads users of all levels to what is fundamentally important to control.
Render Settings Tabs
We re-organized the mental ray Render Settings into four main tabs:
The Quality tab contains quality settings for controlling sampling. By using quality settings, instead of sample counts, we take advantage of better optimization schemes internally. We also believe it will be conceptually easier, once the community gets familiar with this style of control.
The Scene tab contains shared settings across scene elements, such as camera settings that should be applied to all renderable cameras. This is where we provide the new simplified mental ray Passes.
The Configuration tab contains settings that are more likely to be used across Maya sessions, and how a user likes to work with the scene. For example, the interactive rendering control for progressive rendering depends on a machine’s resources.
The Diagnostics tab contains settings that help a user with problem solving, or identification of areas for optimization.
Here, we provide an overview of how to adjust your scenes with the new UI, suggesting our recommended practice.
For new scenes, use the Overall Quality setting in the Sampling section as the primary control for speed vs. quality. It is located at the top of the Quality tab.This controls samples across a scene. Samples are not fixed per pixel. Rather, they vary in density per pixel region. More samples are taken in each region until the quality is matched.
In the next section, we provide detail to better understand how to adjust quality beyond the Overall Quality setting. With better understanding, we hope you can more quickly achieve your desired results.
Understanding more about quality adjustment
Here, we introduce the concept of global vs. local sampling. This concept is key to adjusting quality now and in the future, as rendering technology evolves.
The Overall Quality setting is a global setting that controls samples across a scene. Each sample starts a ray traced from the camera out into the scene. In essence, we sample the scene from the eye (E). Below, we show an eye ray (in green) over a work by Albrecht Dürer.
When an eye ray intersects an object, the eye ray may split into several samples. We will call those the local samples, in contrast to the global samples, because they are local to each eye ray. Below, we show a diffuse distribution of local samples split out for diffuse reflection.
We separate the local samples into two categories at an intersection point: the samples used for lights and the samples used for materials.
For materials, the sample directions depend on the type of surface at the intersection point. For example, above a diffuse surface creates samples in the hemisphere above the intersection point. Because these samples tend to hit objects, it represents indirect light.
For lighting, the samples are taken from all visible lights in the scene. Below, we see a single light sample for the same intersection point. There could be more light samples depending on number and size of lights. Light samples represent direct light.
Traditionally, lights were only those elements specified explicitly as lights in the scene, and they had no size. However, as rendering implementations evolved, so did lights, from point to area lights, and now, emissive objects. Also, consider the light from an environment. Environments convert automatically into light sources by enabling environment light emission. When enabled, we provide a separate quality control for the environment lighting.Note that it is grayed out when not enabled. Furthermore, now one can create such a light more directly. See for example Create > Lights > Environment Image (IBL).
Similarly, we provide a separate control for indirect diffuse (GI) quality in materials, even though it is conceptually a part of material quality.As global illumination techniques have evolved considerably, so have the ways to control these techniques. Yet, the Indirect Diffuse Quality applies to any Indirect Diffuse (GI) Mode selected, and to any material used.
In our next mental ray for Maya 2016 Render Settings post, we provide more details and examples for Adjusting Quality.
In this post, we introduce the newest features of the mental ray for Maya 2016 plugin that is delivered with Autodesk Maya 2016 and can be downloaded here. Stay tuned for more in-depth posts on the features.
Render Settings Redesign
This version comes with a complete new layout of the Render Settings. Our goal is to make the rendering experience with mental ray straight forward and easy. Settings are greatly simplified and grouped together. Five tabs allow to find settings sorted by topic. For advanced users, each tab provides the ‘Advanced Settings’ mode with more detailed controls to fine-tune the rendering.
The Scene tab contains a simplified render passes system for standard utility passes
as well as MILA Light Path and Matte Pass passes.
A more throrough introduction to the new Render Settings will follow shortly.
NVIDIA Material Definition Language
mental ray 3.13 renders materials defined by the NVIDIA Material Definition Language (MDL). MDL is an NVIDIA initiative to standardize physically based material designs in a common format, see http://www.nvidia.com/MDL. Prepackaged MDL materials can be applied in mental ray for Maya 2016. We will provide you with an introduction on how to use MDL in Maya 2016 and with examples for download in this blog soon.
Light Importance Sampling By Default
Light Importance Sampling is now enabled by default. It gives a significant speed / quality advantage out of the box especially with modern and complex lighting setups, emissive objects, and very many light sources. In addition, new heuristics have been incorporated that automatically determine which light sources in the scene are physically plausible and would benefit from importance sampling. This way, traditional idealized light sources and simple lighting setups can be detected and handled separately, like they may be excluded from importance sampling to retain an overall benefit even though this feature is generally enabled. Custom light shaders are fully supported and will be included in importance sampling if they adhere to physically plausible emission and distribution rules.
mental ray 3.13 adds support for generating ‘deep’ data and output to OpenEXR files. The resulting image is saved in the DeepTile form of the OpenEXR 2.0 file format, storing additional information of the pixel colors along the Z axis. It is possible to save deep and simple 2D data into different frame buffers during the same rendering.
UV Tiles Optimized
Rendering UV-tiled textures is faster and more memory efficient in this version because it is based on a native mental ray shader. It auto-creates and loads the tile textures into mental ray on demand, making sure that only those tiles that are actually accessed get loaded into memory. The shader is part of a new package called coreutil, which collects essential mental ray utilities and helper functions.
Create Lights menu
There is a new section in the Create|Lights menu for mental ray lights showing modern mental ray lights in a prominent and easily accessible place.
Using custom geometry to light your scene is now possible with mental ray for Maya 2016. You can assign the new ‘Object Light’ material to your geometry or, with the geometry selected, you can choose ‘Object Light’ from the new mental ray section in the Create|Lights menu. This will turn your geometry into a light.
Light bulb model courtesy of David Hackett.
Rendering Bifrost with mental ray
Bifröst is a procedural framework that can create simulated effects ranging from liquid to foam, bubbles, spray and mist. These effects can be rendered using the bifrost geometry shader delivered with mental ray for Maya 2016.
Autodesk published videos on bifrost and showing mental ray rendering at the end of each:
Rendering XGen with mental ray has been improved and enhanced with new features.
The default XGen hair shader for mental ray is now xgen_hair_physical. It is based on the mental ray human hair shader mib_illum_hair_x which has been improved with mental ray 3.13. It now adds contributions from indirect lighting to the shading. New parameters have been added to tune the tube shading look and to control the internal color noise effect.
Displacing sphere and dart primitives is now possible allowing for a much wider use-case for these primitives.
Texture Filtering based on Ray-Differentials
For advanced ‘elliptical’ texture filtering in Maya’s file node, we are now using ray differentials provided by mental ray core. This introduces more accurate and artifact-free texture filtering even across ray traced reflections and refractions.
To enable it, select a file node, choose ‘Mipmap’ as filtertype, go to the mental ray section and enable ‘Elliptical filtering’. You can choose between ‘Bilinear’ or ‘Bicubic’ filter mode.
Today we want to talk about how to use a custom hair shader to render XGen hair in mental ray for Maya. We will see how such a shader can be assigned, how various helper nodes can be used to alter the appearance of the hair and finally, we will make use of Disney’s expression language SeExpr() to create some interesting effects. For this purpose we use this little doll with a simple XGen hair cut:
By default, XGen uses the xgen_hair_phen shader. This shader mimics the appearance of hair by using a classical Phong model with 2 specular lobes. The shader’s diffuse color parameter can be fed by the custom XGen shader parameters root_color and tip_color. Those need to be defined in the “XGen Window” and allow us to make use of SeExpr(). We won’t go into details on xgen_hair_phen here but simply link to a good overview of all its parameters and an interesting tutorial on how to use it instead.
We start by assigning a different hair shader. For this, we select the XGen hair collection node in the “Outliner”, then choose “Assign New Material” under the “Lighting/Shading” menu and finally apply mib_illum_hair_x:
After some parameter tweaking, we end up with the following rendering:
Let’s add some root-to-tip color variation. In “Hypershade”, we create an xgen_root_tip_color_blend node and feed it into both the diffuse and the secondary color slots of the mib_illum_hair_x shader. The shader provides two color inputs which are blended together over the length of the hair. We choose the root color to be the same we had in mib_illum_hair_x before and orange for the tip:
To get some color variation not only along the length of the hair but also across the head, we now apply a texture to the root_color by connecting anxgen_ptex_lookup. We load the XGen region map for want of a better texture. Here is the result:
So far so good. But still no expressions involved.
In the “Output/Preview” section of the “XGen Window”, we add a new parameter of type color and name it custom_color (any name will do here):
The custom_color parameter appears in the UI but it does not look like a color yet. The little icon next to the new parameter will bring up the “Expression Editor”. We open it and type in the expression seen below to make it a color (red, for now):
Now let’s connect this newly created variable to our shading network. We create a xgen_seexpr node and connect it to the tip_color input of the xgen_root_tip_color_blend shader:
To make use of our custom_color parameter in the xgen_seexpr shader, we then type its name in the shader’s Customs attribute and type the expression $custom_color; into the Expression field:
The rendering shows that the custom_color parameter has been picked up correctly:
Finally, lets replace this simple color by a more complex expression. XGen provides quite a long list of expression samples which can be accessed as shown in the image below. From the “Color” subset we choose “NoiseC”.
A bunch of new parameters will be added below our custom_shader parameters, Those parameters define the noise function we just selected. Instead of modifying them directly in the XGen window, let’s open the expression editor for immediate visual feedback. After some value tuning we get a quite colorful map:
And here the rendering we get out of this:
We could alter the expression to change the look even further, we could create more custom parameters and combine them in the xgen_seexpr shader, the possibilities are endless, so we simply leave further experiments to you and your imagination!
For those who use mental ray Standalone to render on a remote computer or in a render farm, the creation of a scene file in the proprietary .mi format is a necessary step. Most content creation tools are able to “echo” the full scene into a .mi representation on disk using mental ray’s built-in capability. But mental ray for Maya implements a much more flexible approach with extra functionality to ease render pipeline integration. In this post we would like to take a closer look at some of these features.
The mental ray export options can be opened in Maya’s “Export All” or Export Selected” windows by sliding the separator handle to the left.
Or, click the little options box next to “Export All” or “Export Selected” menu items.
Last but not least, the file export can be triggered and controlled via scripting, like in the Script Editor. We show an example towards the end of this post.
Export Binary vs. Ascii
Similar to Maya’s ascii (.ma) vs. binary (.mb) scene formats, the .mi file can also come in two flavors: ascii or binary. The binary variant is the preferred choice when the precision of the scene data should be retained. The reason is, floating-point numbers are written in a binary form with no loss of bits and precision. Maya’s mental ray export enables binary by default.
That’s perfectly fine if you just like to feed that .mi file to Standalone for final rendering, and not touch it. In a production studio environment this is rarely the case, though. Typically, all the assets (textures, materials, geometry, …) are collected from different sources or departments, and may undergo steps of post-processing and editing before passing to the renderer. The ascii version of the .mi export is often better suited in such situations since it allows simple text editing and easier scripting. On the other hand, it may result in larger file sizes, and can lead to precision problems due to lossy ascii-binary conversions. There are ways to solve that with mental ray for Maya. Let’s take a closer look in the next sections.
The mental ray for Maya export engine can be tuned to use a more exact ascii conversion of extreme values that reside close to the edge of the floating-point precision range. Especially single-precision floating-point data are prone to this problem. Guess what, this is (still) most widely used to represent 3D scene geometry and transformation operations. The standard ascii conversion, which is using a maximum of 6 significant digits for single-precision values (15 digits for double-precision), can be increased up to 9 (or 18, respectively), by creating the following dynamic attributes in your scene prior to export.
Large scene dimensions and hierarchies, but also repetitive use of certain Maya modeling operations, can lead to such extreme values, see hints in the older Autodesk Knowledge Base Article.
Export File Path
A typical .mi scene contains various references to external files, like textures, finalgather maps, or output images. When rendering on a remote machine or in the render farm, the directory path to these files may be totally different than what was used on the exporting machine. Therefore, it is often desirable to not write an absolute file path into the .mi file, but just the relative one rooted at the project directory, or no path at all, and then use mental ray Standalone’s search path configuration on the remote computer to point to the right folders, or shared network drives. For example, using the “-T <path>” command line option, or the _MI_REG_TEXTURE registry value.
The mental ray for Maya export options provide selective control for each type of file.
This section of the export options allows to create .mi files that only contain elements of a certain scene type, like all “textures”, or all “materials”. It translates the full scene as usual but actually writes only the pieces selected in the “filter”. This way it is possible to split up a large scene into more manageable .mi parts that fit together perfectly. Here is an example. It will export three .mi files:
The “textures.mi” file contains just the textures references, all with absolute file path. The “scene.mi” file carries most of the scene data, geometry, lights and materials, and gets compressed to save disk space. Finally, the last one “render.mi” stores the render options, render cameras, and the final render command. Now, the first two .mi files can be included into the last one “render.mi” to create a renderable “master” .mi file, see this .mi snippet:
The resulting .mi file can be given to mental ray Standalone for final rendering. Arrgh, I got a new version of one of the textures last minute! Well, no problem! Just update the “textures.mi” file, no need to touch any of the heavy data. And re-render. Voila!
While this works great in general, it does not help the renderer to load certain scene parts on demand only, like when it is actually “seen” during rendering. That’s where mental ray “assemblies” come into play.
This export option helps to create a valid mental ray “assembly” from a Maya scene. It writes a normal .mi file with a few special properties. A mental ray assembly is used to store a larger part of the scene that belongs together spatially, like a character or a whole building. Normally, it comprises the geometry details of the sub-scene and related local properties like materials.
Such a .mi file can be referenced from a “master” scene “stand-in” bounding box object, which defines the ultimate location and scale in the global space.
In contrast to Maya file references, such an assembly is not loaded or shown in Maya immediately, thus not filling up memory and impacting your modeling operations. Instead, mental ray will load these parts only on demand during rendering, and even unload the piece in case room for other assemblies is needed. This mechanism enables the renderer to handle massive amounts of scene elements more efficiently, and keep memory consumption under control. The resulting rendering is no different to a regular render.
If you like to build a scene that contains huge amounts of similar looking objects that can share the actual assembly geometry, we suggest to use instances of the same assembly rather than copies (!) (which is the default “duplicate” operation in Maya). The placement and scale of the stand-in “proxy” element referencing the assembly determines the final location and size in the final rendering.
This technique of using mental ray assemblies is also available to shader writers and integrators through the programming API. In fact, it is utilized in the mental ray implementation of crowd simulation engines like Massive for Maya, or Maya’s native procedural generator XGen, to handle incredible amount of elements.
We hope these tips will help you in your daily work.
BTW, there are more possibilities to tweak .mi file export even further (“text boxes”). But they are rarely used, and would justify another blog post in case there is interest. Just let us know.