Can't Export usdShadeShaders to MDL using Create

Hi,

I’m having trouble with the mdl export extension

The first thing I want to note is that I don’t think it works in 2022.1.2, but seems to function in 2022.0.1 (the ‘test extension’ function in the extension manager still appeared to fail in both)

But my main problem has to do with the export process itself. My first test was to import an mdl file, export it, reimport it, and use it.

The size alone shows that the material definition was not exported in full.

mdls are ascii files so I inspected the result. it seems it’s just trying to reference the old material. I will attach both below.

I’m wondering why it isn’t self contained…

For some extra background on my goal here:

I have some mdls unlike the copper material I used for testing that are many years old and are not defined as individual files. Instead they all reference ‘architectural.mdl’. I want to turn these old iray mdl materials into new ones that are each stored in their own file. Can I use the extension in this way?

Maybe it’s something to do with how the shaders are created in Create and my materials being predefined don’t translate to usdShade as expected?

Any advice is welcome.




Some errors that I only get sometimes and the files - the small one is the one generated by Create:
copper.mdl (638 Bytes)

copper.mdl (4.6 KB)

I couldn’t do that too. Ended up exporting an USD which stores the material for later use.

Hey Hey! I am asking the dev team to look into this. I appreciate you letting us know!

1 Like

Hi @LMTraina99

The MDL Exporter doesn’t export an identical copy of the original MDL. Instead it wraps the original MDL was a template.

You can see that there is an import path to the original

import ::Z16C_3A::Users::SNIC_SA::Documents::Matts_Omniverse_Environment::IrayStuff::m_new::Mats_v2::nvidia::vMaterials::Design::Metal::Z9Ccopper_2Emdl::copper;

And then the call to the material

= Z16C_3A::Users::SNIC_SA::Documents::Matts_Omniverse_Environment::IrayStuff::m_new::Mats_v2::nvidia::vMaterials::Design::Metal::Z9Ccopper_2Emdl::copper(

base_color: color(0.722670615f, 0.311180413f, 0.186988205f),

reflection_roughness: 0.140000001f,

anisotropy: 0.200000003f,

anisotropy_rotation: 0.f,

bump_strength: 1.f,

texture_scale: float3(1.f));

The intent of this feature is to allow you to capture modifications made via UsdShade graphs and fold those modifications back into MDL. It wasn’t really designed to parse and replicate the original source code. Which is possible but significantly more tricky.

For the problem you’re trying to solve, is there an advantage for you to have architectural.mdl as individual files?

Thank you for the question,
@fpliu

1 Like

I see - that makes sense based on the file contents, though I’m not sure why the file doesn’t resolve when reimported into create. If it’s really just referencing the old material I’m not sure what those console errors shown above have to do with that (maybe something else is causing them).

For the problem I’m trying to solve I need a database of materials and corresponding material ID numbers. For the sake of simplicity I couldn’t have materials referencing this ‘architectural.mdl’ - I want the finalized materials that come out of iray (all based upon that original material).

To contrast this:
A subset of my library consists of modern mdl files that are self-contained and easily referenced - the goal was to convert the old materials to this format. These modern ones have many subidentifiers and can contain many different shaders with similar physical properties (i.e. Glossy Paints with subidentifiers for many different colors of paint that just change the base_color). This is ideal. The architectural.mdl file does not work this way - it has barely anything in it and I think is just a template that is used by Iray and Create to make shaders in each software.

Even with the way this USDShade exporter works, it seems this should still be possible, they’ll just be constructed a little differently - please correct me if I’m wrong.

If there’s anything I can make clearer please let me know

I appreciate your time and your response, thank you!