Error importing an MDL material into shader mixer

AnimAnim Posts: 241

I am trying to understand MDL shader creation for Daz Studio.

Using:
- Substance Desinger 2021 as MDL editor
- Daz Studio 4.15 beta (latest version)

Issue:

When draging the MDL file into Shader Mixer I get errors regarding the import of modules:

WARNING: QLayout: Attempting to add QLayout "" to DzShaderMixerChooserDialog "New Shader", which already has a layout
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [ERROR] - MDLC:COMPILER ::   1.0   MDLC   comp error: E:\Ressources\Materials\MDL\MDL_Test.mdl(3,10): could not find module '::alg::base::core' in module path
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [ERROR] - MDLC:COMPILER ::   1.0   MDLC   comp error: E:\Ressources\Materials\MDL\MDL_Test.mdl(4,10): could not find module '::alg::base::core' in module path
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(21,8): used material 'material MDL_Test' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(22,19): used parameter 'IOR' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(32,11): used parameter 'roughness' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(41,19): used parameter 'scattering' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(51,19): used parameter 'absorptionColor' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(59,11): used parameter 'basecolor' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(67,19): used parameter 'absorption' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [WARNING] - MDLC:COMPILER ::   1.0   MDLC   comp warn : E:\Ressources\Materials\MDL\MDL_Test.mdl(77,12): used parameter 'normal' marked with anno::unused() annotation
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [ERROR] - MDLC:COMPILER ::   1.0   MDLC   comp error: E:\Ressources\Materials\MDL\MDL_Test.mdl(99,37): 'alg::base::core' is not a package or module name
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(359): Iray [ERROR] - MDLC:COMPILER ::   1.0   MDLC   comp error: E:\Ressources\Materials\MDL\MDL_Test.mdl(99,102): 'alg::base::core' is not a package or module name
WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(1437): MDL Import Error (4003) : The module "::MDL_Test" was not found or failed to compile.

 

What I did:

Set MDL pathes in Shader Mixer:

Opened a translucent MDL in Substance Designer (it is a build in MDL):

Exported it as MDL file:

Chose "New Shader" in Shader Mixer and deleted the default Bricks

Dragged and dropped the MDL file into the Shader Mixer window.

Result: got an error message. Details are shown in the log message above.

Can somebody help with information about the module import issue?

Daz-MDL-Pathes.png
685 x 312 - 42K
Substance-Desinger.png
682 x 1171 - 341K
Explorer.png
836 x 195 - 16K
Post edited by Anim on

Comments

  • alg:base indicates that those are parts of the Algorithmic code, I think it can be exported too but then the are restrictions on what you can do with the shader (if you want to share it with others etc.).

  • AnimAnim Posts: 241

    Any Substance Desinger user here who might have an idea how to solve this?

    I posted in the substance3d forum as well.

  • AnimAnim Posts: 241

    Forgot to attach the mdl file - here it is now.

    mdl
    mdl
    MDL_Test.mdl
    5K
  • OmnifluxOmniflux Posts: 371

    Your MDL file is trying to reference another MDL file that DS does not know how to find. There are a couple ways to solve this.

    You can add the MDL directory Substance Designer uses to DS, which should be something similar to one of these:

    • C:\Program Files\Allegorithmic\Substance Designer\resources\view3d\iray
    • C:\Program Files (x86)\Steam\steamapps\common\Substance Designer 2018\resources\view3d\iray

    or if it is just alg::base::core you are missing, you can install the NVIDIA MDL Material Exchange (the latest version of which is only available with NVIDIA vMaterials) and add the MDL directory that it installs to DS.

    I have created a set of presets to go with NVIDIA vMaterials if you choose that route (NVIDIA vMaterials 1.7.0 Presets).

    Also, I don't think you need to add DS's MDL directory manually as you have, as it is included in a set of built in resource directories.

     

    Here is another thread which also discusses this issue - MDL, Studio and Substance Designer

  • AnimAnim Posts: 241

    Thanks a lot Omniflux. Hope you don't mind me asking more questions.

    What I understand now:

    The Substance MDL is indeed importing modules:

    import ::alg::base::core::volume_absorption;
    import ::alg::base::core::volume_scattering;
    import ::anno:: ...

    Those modules are in the Substance path you mentioned.

    I got it that those modules need to be in the DAZ search path so that they can be found.

    It seems there is another issue in the Substance exported MDL.

    anno::unused("BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjpnYW1tYV90eXBlKDo6dGV4OjpnYW1tYV9saW5lYXIp"),

    On import DAZ creates a warning regarding those "unsused" entries. I'll try to find out what that means.

    Question 1:

    Do you know how to avoid the dependency to the Substance modules? The goal is to have shaders that work in DAZ without modules from Substance. Otherwise the whole idea of exchanging materials won't work.

    Question 2:

    First, thanks for the converter script. I used it and it created the "MDL_Test" in "MDL Converted Shaders".

    I am trying to understand what it does. It seems it creates support bricks which are needed in DAZ to use an MDL shader. Is that correct?

    Do you know where to find a documentation about those support bricks? I like to understand the how and why regarding them.

    Again, thanks for your help.

  • OmnifluxOmniflux Posts: 371

    Anim said:

    Do you know how to avoid the dependency to the Substance modules?

    Unfortunately, no. However, NVIDIA distributes the alg::base::core module (among others) in the MDL Material Exchange so either Allegorithmic (creator of Substance) may offer a way to license distributing of the modules, or you can tell people they have to install the freely available MDL Material Exchange first if it includes all the modules Substance uses as dependencies. Not ideal, but not completely unworkable. DAZ already ships the NVIDIA modules from the MDL Material Exchange with DAZ, so it would be nice if they also included the others, but perhaps there were licensing issues they could not resolve or did not forsee the need to pursue.

    First, thanks for the converter script. I used it and it created the "MDL_Test" in "MDL Converted Shaders".

    I hope it worked well for you. I have not received any feedback on it so can only assume it works for others.

    I am trying to understand what it does. It seems it creates support bricks which are needed in DAZ to use an MDL shader. Is that correct?

    Yes, this is correct. DS has support to autoconnect most bricks together if you can tell it which bricks to connect to together, so that's what this script does.

    Do you know where to find a documentation about those support bricks? I like to understand the how and why regarding them.

    Unfortunately, this portion of DS is undocumented at this time. I think much of it is also unsupported in the current SDK. My personal hope is that the next time the SDK gets a major update (there are things pointing to this being later this year, although no official statements yet), we will also get documentation on several currently undocumented scripting aspects.

    I researched the bricks by building things in the Shader Mixer, and then finding the matching brick objects through introspection.

    There are several posts in the forum on introspection of the scripting environment. The method I generally use is from @rbtwhiz in this post.

    Here is the relevant code from his post placed in a function and an example of how to use it to examine an object.

    // Derived from rbtwhiz at http://www.daz3d.com/forums/discussion/37769/how-do-you-set-the-property-value-slider-in-the-parameters-tab#Comment_557942(function(){		function printObjectInfo (object)	{		if (object)		{			var oDefinition;			var aMembers = [];			for (var sMember in object)			{				oDefinition = object [sMember];				switch (typeof (oDefinition))				{					case "function":						aMembers.push (sMember);						break;					case "object":						if (oDefinition.toString().startsWith ("[") && oDefinition.className)							aMembers.push ([sMember, "=", oDefinition.className()].join (" "));						else							aMembers.push ([sMember, "=", oDefinition].join (" "));						break;					default:						aMembers.push ([sMember, "=", oDefinition].join (" "));						break;				}			}			aMembers.sort();			print (aMembers.join ("\n"));		}	}	printObjectInfo (this); // Displays all globals - this is where you want to start.	printObjectInfo (DzMdlNVIDIACoreDefinitionsAddCutout()); // Displays all properties et al. of the MDL Cutout Brick found from the above line})();

     

  • AnimAnim Posts: 241

    Thanks for the answers. I need to dig deeper into this hoping to be able to create shaders in the future.

    Regarding the converter script. It worked without issues. After mapping the module pathes and using the script I was able to render with the MDL_Test.mdl shader.

Sign In or Register to comment.