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.

Light Path Expressions Improvements in 3ds Max 2016

Starting with iray in 3ds Max 2015 you can render different bits of information into different buffers using Light Path Expressions (LPEs). LPEs are exposed through iray Render Elements.

LPEs are regular expressions that match some light transport paths that iray generates. Each result buffer can be associated with an LPE so that only paths which match the expression end up contributing to that buffer. The iray renderer also allows you to render several buffers with different LPEs at the same time at almost no additional runtime cost. LPEs can distinguish between different surface properties such as diffuse or glossy, reflection or refraction, types of light sources, and names.

In 3ds Max 2016, LPEs have been extended to allow light-specific and object-specific paths.

Light-specific LPEs allow to render your scene per light source. You can then adjust light intensities in a post process, weighing them together.

Object-specific allow to render your scene per object. You can then perform artistic compositing of an image, for example by subtracting an object’s reflection from the beauty image or by adding glow to the image.

For examples of LPE usage, check out these iray blog posts:
Compositing with Light Path Expressions
Instant Relighting & Nonphysical Effects
Get a grip (2): instant color change

Lights and objects need to be grouped into layers before they can be referenced in LPEs.

Below is an example how to achieve this. You can download the example scene from https://s3.amazonaws.com/arcdownload/irayLPESceneUsingLightsAndObjectsHandles.zip.

Open “Tools/Layer Explorer…” to group objects (e.g. the cosmetic box below is under a layer named “container”):


Grouping geometry in the Layer Explorer

The “container” can then be referenced in an LPE "L.*'container'RE" (reflections of the cosmetic box):


Creating an LPE with object-specific path

containerreflectionsRendering "L.*'container'RE"

In the same way lights can be grouped into layer and referenced in an LPE:


Creating an LPE with light-specific path

right_lightRendering "<L'light_right'>.*E"

Hope you will find this post useful.

mental ray for 3ds Max 2016

Here is an overview of the mental ray and iray features which were integrated in 3ds Max 2016.

NVIDIA Material Definition Language (MDL)

The Material Definition Language (MDL) is an NVIDIA initiative to standardize physically based material designs in a common format, see http://www.nvidia.com/MDL. mental ray for 3ds Max 2016 is capable of rendering pre-packaged MDL materials. We will create a dedicated blog post to explain how to enable MDL in 3ds Max 2016.

mdl_examples_3dsmax Rendering MDL with mental ray

Light Importance Sampling (LIS)

The new Light Importance Sampling mechanism in mental ray allows to sample the whole set of lights as if it were one single light, placing more samples on the lights that contribute more to the part of the scene being rendered. It is an importance-driven mechanism that is controlled by a simple set of parameters. Both area and point lights are importance-sampled, and there is no fundamental change required in material and light shaders. This mechanism is typically useful in scenes with many lights, but can be beneficial also in other simpler cases.


Light Importance Sampling parameters

Ambient Occlusion, GPU accelerated

mental ray offers a new, efficient, GPU accelerated “mr Ambient Occlusion” render element.

aomr Ambient Occlusion Render Element

aoparmsmr Ambient Occlusion parameters

The “Max Distance” controls the maximum distance of occlusion probe rays (Note: Value 0 for “Max Distance” means infinite distance). “Falloff” controls how much the occlusion fades out with distance.

Displacement Settings

The mental ray and the iray renderers now offer the “Parametric” approximation method which can help to troubleshoot scenes where the “Length” method exhibits artifacts, for example scenes with very regular and flat geometry. This method is available from the “Render Setup/Renderer” tab and from the “Object Properties/mental ray” tab.


Object Properties/mental ray tab – Displacement Settings

The parametric approximation method regularly subdivides each triangle of the surface. The “Subdivision Level” specifies how many times each input triangle should be subdivided. A higher “Subdivision Level” results in a higher triangle count. Each input triangle is subdivided into 4(Subdivision Level) triangles. Note: there is an internal limit of 8 million triangles per object.

Section Plane

The iray renderer offers a new helper object “iray Section”. The “iray Section” behaves similarly to the “Grid” helper and is used to cut off the geometry in the rendered image. Section planes can either cut off the geometry completely (so let the light in), or let the viewer take a peek inside, see “Clip Light” parameter. You can define up to 8 section planes.

sectionplaneiray Section Plane Helper

Texture Compression

The iray “Texture Compression” can save around 75% of texture memory on both CPU and GPU. This is enabled by default. See http://blog.irayrender.com/post/54506874080/saving-on-texture-memory for details, the level of compression exposed in 3ds Max 2016 is the “medium”.

texturecompressionTexture Compression parameters

Light Path Expressions Improvements

Light Path Expressions (LPEs) for iray have been extended to allow light-specific and object-specific paths.

Lights and objects need to be grouped into layers before they can be referenced in LPEs.

We will create a dedicated blogpost to explain this mechanism.

Irradiance Render Element

The iray renderer offers a new Render Element “iray: Irradiance”:

irradianceRender Element “iray: Irradiance”

irradiance_parmsIrradiance parameters

It is recommended to turn off tone mapping when computing irradiance. By default the irradiance buffer is converted to a heatmap, displaying the lux (or footcandle) values with false colors:

irradiance_bufferRendering Irradiance with heatmap on

Auxiliary Buffers Render Elements: Alpha, Normal, Depth

The iray renderer also offers auxiliary buffers Render Elements (Alpha, Normal and Depth):

auxiliaryAuxiliary buffers Render Elements

auxiliary_buffersRendering Auxiliary buffers

Here is for the tour of the new mental ray and iray features integrated in 3ds Max 2016.

Hope you will find this useful.

Pascal

mental ray iray Maxwell support in 3ds Max 2015 SP2

Maxwell GPUs

Maxwell is NVIDIA’s next-generation GPU architecture for CUDA compute applications.

Please check the current list of Maxwell GPUs.

In order for iray to render on Maxwell GPU you need to patch the iray library which is distributed with 3ds Max 2015 SP2.

Without this patch, iray in 3ds Max 2015 SP2 will render using CPU only, if you have a Maxwell GPU.

Step by Step Procedure

Backup iray Library

iray library is typically located under:

C:\Program Files\Autodesk\3ds Max 2015\libiray.dll

The version which ships with 3ds Max SP2 is 3.12.1.17:

3.12.1.17

Rename or move your original iray library in case you want to revert back to it.

Update iray Library

Download iray library version 3.12.1.18 and place it under:

C:\Program Files\Autodesk\3ds Max 2015\libiray.dll

3.12.1.18

Restart 3ds Max 2015

Future patches and releases of 3ds Max will automatically support Maxwell generation GPUs.

More information on Maxwell architecture.

Export your scene as .mi file from 3ds Max

Let’s pick up on the topic Let .mi export… and show how to export to .mi from 3ds Max.

Step by Step Procedure

You can simply export your scene to an .mi file in 3ds Max when using mental ray as Production renderer.

  • Go to “Rendering/Render Setup” or press F10.
  • Choose NVIDIA mental ray as Production renderer.
  • You find “Export to .mi File” in the “Processing” panel in the “Translator Options” rollout.
    Note: All the controls (but the “Browse…” button) are initially greyed out until a filename is specified.

export

  • Press the “Browse…” button to spectify the .mi file output.
  • Render or press Shift+Q. Instead of actually rendering, the scene is exported to .mi file.

You can use mental ray Standalone to render the exported .mi file.
Note: When rendering with Standalone you might see errors about missing SubstanceShader.dll and PointCloudShader.dll. These errors can usually be ignored and do not prevent proper rendering. You might want to delete the corresponding link in the .mi file to prevent these errors to show up (see link directives at the top of the .mi file).

User Interface

3dsmax_exportmifile_detail

“Export on Render”

Uncheck “Export on Render” if you want to render to the viewport instead of export to .mi file.

“Un-compressed”

If you choose to export “Un-compressed” (the default), the three dimensional vectors in objects are echoed in ASCII format. If you uncheck this option and choose to export compressed, vectors in objects are exported in binary format resulting in a smaller .mi file size and in exact floating point precision. See also the section “Export Binary vs. Ascii” in the post about exporting to .mi file in Maya.

“Incremental (Single File)”

If you select “Incremental (Single File)” options, animations are exported as a single .mi file that contains a definition of the first frame and descriptors of the incremental changes from frame to frame. If you uncheck “Incremental (Single File)”, each frame is exported as a separate .mi file.

“Browse …”

Allows to specify the output file name.