Using MDL with mental ray for Maya 2016

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”.

Create MDL material node

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:

mdl-material-property-view

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:

mdl-directory

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:

maya-env

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

MI_MDL_PATH=C:\users\<USERNAME>\Documents\Maya\2016\mdl

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:

Example PackageWhen 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.

mdl-with-render

Other MDL materials, focused on requirements from the automotive industry are available for download in the Advanced Rendering Forum.

Limitations

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.

Using MDL with mental ray in 3ds Max 2016

Following the introduction, we will now go through the steps to render MDL materials in 3ds Max 2016. In the instructions below, [3dsMax2016] referes to the folder where 3ds Max 2016 is installed (typically C:\Program Files\Autodesk\3ds Max 2016).

Installation

1. Unzip the attached package NVIDIA_MDL_3dsMax into a temporary folder.

The package NVIDIA_MDL_3dsMax.zip contains the following files:

  • mdl_examples_for_maya_3dsmax.zip – Archive with mdl examples
  • libmdl.dll  –  Latest version (3.13.1.8) of the MDL mental ray dll
  • mdl_max.mi  –  GUI file to display pretty MDL names
  • MDLScene.max  –  Sample 3ds Max scene with MDL materials

2. Unzip mdl_examples_for_maya_3dsmax.zip into a newly created folder  [3dsMax2016]\NVIDIA\shaders_3rdparty\mdl\

You should end up with the following files:ExplorerViewOnMaxMdlExamples

3. Install the file mdl_max.mi in the folder [3dsMax2016]\NVIDIA\shaders_autoload\mentalray\include\

4. Copy the new version of libmdl.dll into the folder: [3dsMax2016]\

 

Rendering in 3ds Max 2016

Start 3ds Max 2016, chose mr production renderer and open material editor. You should see a new set of materials:

mtls

You might want to load the scene MDLScene.max, it has some MDL materials already set.
Here is mental ray rendering with few MDL materials assigned:

mr

And iray rendering:

iray

NVIDIA Material Definition Language (MDL) with mental ray

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.MDL materials rendered with mental ray

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.

Introducing mental ray for Maya 2016 Render Settings

This is the first in a series of posts on mental ray for Maya 2016 Render Settings

Introduction

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.

Goals

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.

Quality Settings

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.

durerWhen 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.

eye_rayWe 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.

light_rayTraditionally, 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.