This page provides information on the MDL Material.


Overview


The VRayMDLMtl material loads NVIDIA Material Definition Language files (.mdl) and renders them directly with V-Ray.

V-Ray supports NVIDIA Material Definition Language, version 1.7.2.




Installed Material Library


The following MDL material files are included when installing V-Ray, starting with V-Ray for 3ds Max 3.5. They are located in Local Disk (C:) > Program Files > Chaos Group > V-Ray > 3dsmax 20xx for x64 > mdl



 
Aluminum Anodized



Architectural



Asphalt





Carbon composite



Carpet Berber White



Ceramic Tiles Small




 
Chrome


 
Coated Flipflop Paint


 
Coated Flint Glass




 
Colored Wax


 
Concrete


 
Concrete Polished




 
Copper


 
Granite Black


 
Mahogany Floorboards




 
Marble White


 
Metal Examples


 
Noise Flow Glossy




 
Noise Perlin Glossy


 
Noise Worley Glossy


 
Pattern Blended




 
Pattern Checker Glossy


 
Porcelain


 
Resin Polyurethane Matte




 
Rubber Studded Black


 
Stucco


 
Walnut Semi Gloss




General


The General rollout holds parameters that control common shader characteristics.

MDL filename – Specifies the .mdl file. This button control also supports a context menu with the following options:

Clear – Unloads the current shader and restores the plug-in as if no shaders have been loaded.  
Open Containing Folder – Reveals the shader location in Explorer.
Open in External Editor – Opens the shader in an appropriate text editor.
Copy File Path – Puts the full path of the currently loaded file in the clipboard.
Copy Folder Path – Copies the parent directory of the currently loaded file into the clipboard.
Recent Files – Holds a list of the recently loaded shaders and an option to clear the history list.

Shortcut KeyCommand
CClear
OOpen Containing Folder
XOpen in External Editor
FCopy File Path
PCopy Folder Path
TRecent Files
1-0The first 10 items of the Recent Files submenu have assigned shortcuts from 1 to 0

MDL material – Displays the material name.

Max ray depth – Specifies the maximum reflection/refraction depth for the shader.

Show preview – Determines whether to render a shader preview in the material editor.

Clamp shader result – Determines whether to force the result in the [0, Clamping limit ] range or not.

Clamping limit – Specifies the upper clamp limit if Clamp shader result is enabled.

Viewport color – Specifies the diffuse component of the material used in the viewport shading.

Wrap texture coordinates – Automatically wraps the texture coordinates for the MDL material passing only values in the [0.0, 1.0] range.


Compiler Diagnostics


The Compiler Diagnostics rollout holds shader compilation and manipulation result messages.



Parameters


Any additional material-specific parameters (if any) are listed in this rollout. 


MDL Search Paths


The MDL Search Paths rollout hosts the system paths to available mdl modules, as well as options for manually adding and removing additional paths.

System paths are the ones defined with the V-Ray environment variable VRAY_MDL_PATH_3DSMAX20YY_x64 and NVIDIA environment variables MDL_SYSTEM_PATH and MDL_USER_PATH. Additional Paths are used to add root locations that will be searched when the given mdl module is not found in available system paths. Mdl modules can also reside in a sub-folder and will be automatically searched for without the need of adding the sub-folder's explicit path name. If an mdl module is loaded from a location that is not present in an already listed path, a pop-up window prompts you to add it to the list of Additional paths (or else it will not be loaded and rendered). All path lists are stored on a global level and are not scene specific.

 The MDL modules are cached when loaded. If two or more mdl modules with the same name are used this may cause only the first one to be actually loaded.



MAXScript Usage


The MDL Search Paths lists can also be accessed and controlled through MAXScript.

A single VRayMDLMtl object has to be pointed to reach its properties and methods. This can be done by collecting the available VRayMDLMtls in the scene:

mdl=getclassinstances vraymdlmtl

#(Material #25:VRayMDLMtl)


And then focusing on one of them:

mdl=mdl[1]

Material #25:VRayMDLMtl


Since the MDL Search Paths lists have global effect on all VRayMDLMtl materials any of the collected materials can be used in the script.


The .searchpaths property returns an array of all MDL search paths (both System and Additional lists combined):

mdl.searchpaths

#("C:\ProgramData\NVIDIA Corporation\mdl", "C:\Users\CurrentUser\Documents\mdl", "C:\Program Files\Chaos Group\V-Ray\3dsmax 20yy for x64\mdl")




The table below lists the available methods for editing the Additional paths with MAXScript:

Method Description

mdl.addSearchPath <filename>

Adds a path to the Additional paths list.
mdl.removeSearchPath <filename>Removes a path from the Additional paths list.
mdl.clearSearchPaths()Clears all paths from the Additional paths list.


Importing NVIDIA vMaterials

In order for the MDL Material to correctly load NVIDIA vMaterials, the following two paths should be present in the MDL Search paths lists:
%PROGRAMDATA%\NVIDIA Corporation\mdl;
%USERPROFILE%\Documents\mdl

By default, on vMaterials installation they are set in the environment variables MDL_SYSTEM_PATH and MDL_USER_PATH which is the proper workflow. An alternative way to add them to the system paths is to append them to the V-Ray environment variable that specifies default location for MDL modules:

VRAY_MDL_PATH_3DSMAX20yy_x64=%PROGRAMDATA%\NVIDIA Corporation\mdl;%USERPROFILE%\Documents\mdl

where yy is the version of Max installed.

Example:

VRAY_MDL_PATH_3DSMAX2018_x64=C:\Program Files\Chaos Group\V-Ray\3dsmax 2018 for x64\mdl;%PROGRAMDATA%\NVIDIA Corporation\mdl;%USERPROFILE%\Documents\mdl


Importing MDL Files from Substance Designer


In some cases, when using MDL files exported from Substance Designer, V-Ray may fail to load some modules. In order to load these modules, a folder needs to be set up before starting 3ds Max.

  1. Make a folder, for example X:\MDL, that will act as the MDL repository. Put the MDL modules that are exported from Substance Designer into this folder.
  2. Put the textures needed by the MDL materials in the same repository in their respective subfolder (for example, X:\MDL\MDL_Plywood_02).
  3. Tell V-Ray where the MDL repository is by appending it to the VRAY_MDL_PATH_3DSMAX20yy_x64 environment variable.
  4. Find the folder where Substance Designer keeps its MDL modules (usually C:\Program Files\Adobe\Adobe Substance 3D Designer\resources\view3d\iray\alg but may differ from version to version) and append its path to the same environment variable. 

In the end, the environment variable should look something like:

VRAY_MDL_PATH_3DSMAX20yy_x64=C:\Program Files\Chaos Group\V-Ray\3dsmax 20yy for x64\mdl;C:\Program Files\Allegorithmic\Substance Designer 5\resources\view3d\iray;X:\MDL


Known Limitations


  • material_emission.mode is ignored
  • material.backface is ignored
  • df::diffuse_transmission_bsdf is not supported
  • df::backscattering_glossy_reflection_bsdf is not supported
  • df::measured_bsdf is not supported
  • From the “alternative distribution functions”, only df::microfacet_ggx_smith_bsdf is implemented
  • df::measured_edf and df::spot_edf are not supported
  • df::anisotropic_vdf is not supported
  • 3D textures are not yet supported
  • The multiscatter_tint parameter in simple_glossy_bsdf, microfacet_ggx_smith_bsdf, ward_geisler_moroder_bsdf is ignored.
  • The tint (color reflection_tint, color transmission_tint, bsdf base) modifier overload for separate tinting of the reflective and transmissive light paths is not supported.

References