Author Topic: .mdl files  (Read 9350 times)

@hello_25

Which version of Iray are you using? If you are using Iray+ (now known as IRay for 3ds Max), you will need to add the file path for the Substance Designer MDL presets plus the location of where the MDL file that you want to load. All associated bitmaps for the MDL must be in the root folder where the MDL file is located. Make sure you are exporting the Spec/Glossy MDL preset from Substance Designer for this method.

If you are using NVIDIA Iray, which comes with 3ds Max 2016, you will need to copy the Substance Designer MDL presets into the MDL folder. Then create a new folder inside of the root MDL folder where you want the MDL file to live. Again, all associated bitmaps must be in the same directory as the MDL file. Make sure you are exporting the Blinn MDL preset from Substance Designer for this method.

I hope that helps. I can write up some detailed steps if you need a little later. I'm currently still at the office.

What I want to know is if they are going to bring out an update for substance painter that will let you export MDL files.

Hay jaws,

since Substance Painter does not support iRay at the moment, you won't get .mdl files from it.


Best Regards
Environment Artist - Twitter

Okay this is becoming a major pain in the butt. I have been for the last week been trying to export out my MDL to the current version of Iray for Maya 2016. I had one guys from the Iray forum say that the problem lines with the saying that the first problem was with the first line of import code. changeging it from

import ::alg::base::normalmapping::custom_tangent_space_normal_texture;

to

import ::base::tangent_space_normal_texture;

this let me get my MDL to show up in Iray, it doesn't let Iray use the my preset imports. and the whole thing looks like a glowing glass object instead of what I want. While this codeing system works for making MDL for Substance Iray, it doesn't translate well to Maya Iray. It doesn't even load the 2d textures in maya. here is the code for anyone who wants to help me.

mdl 1.1;

import ::base::tangent_space_normal_texture;
import ::alg::materials::physically_metallic_roughness::physically_metallic_roughness;
import ::base::file_texture;
import ::base::mono_mode;
import ::base::rotation_translation_scale;
import ::base::texture_coordinate_info;
import ::base::texture_return;
import ::base::transform_coordinate;
import ::state::texture_coordinate;
import ::state::texture_tangent_u;
import ::state::texture_tangent_v;
import ::tex::gamma_mode;
import ::tex::wrap_mode;
import ::state::normal;

export material head(*)
 = ::alg::materials::physically_metallic_roughness::physically_metallic_roughness(
    ambientOcclusion: 1.f,
    baseColor: ::base::file_texture(texture_2d("" /* tag 3247, version 0 */, ::tex::gamma_default), color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, ::base::transform_coordinate(::base::rotation_translation_scale(float3(0.f), float3(0.f), float3(1.f)), ::base::texture_coordinate_info(::state::texture_coordinate(0), ::state::texture_tangent_u(0), ::state::texture_tangent_v(0))), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).tint,
    emissiveColor: color(0.f, 0.f, 0.f),
    emissiveIntensity: 1.f,
    height: 0.5f,
    heightScale: 0.f,
    metallic: ::base::file_texture(texture_2d("" /* tag 3260, version 0 */, ::tex::gamma_default), color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, ::base::transform_coordinate(::base::rotation_translation_scale(float3(0.f), float3(0.f), float3(1.f)), ::base::texture_coordinate_info(::state::texture_coordinate(0), ::state::texture_tangent_u(0), ::state::texture_tangent_v(0))), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).mono,
    normal: ::base::tangent_space_normal_texture(texture_2d("" /* tag 3273, version 0 */, ::tex::gamma_default), 1.f, false, true, ::base::transform_coordinate(::base::rotation_translation_scale(float3(0.f), float3(0.f), float3(1.f)), ::base::texture_coordinate_info(::state::texture_coordinate(0), ::state::texture_tangent_u(0), ::state::texture_tangent_v(0))), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false, 1.f, 0.f),
    roughness: ::base::file_texture(texture_2d("" /* tag 3285, version 0 */, ::tex::gamma_default), color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, ::base::transform_coordinate(::base::rotation_translation_scale(float3(0.f), float3(0.f), float3(1.f)), ::base::texture_coordinate_info(::state::texture_coordinate(0), ::state::texture_tangent_u(0), ::state::texture_tangent_v(0))), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).mono,
    opacity: 1.f,
    specularLevel: 0.5f,
    anisotropyLevel: 0.f,
    anisotropyAngle: 0.f,
    refraction: 0.f,
    refractionIOR: 1.5f,
    scattering: 0.f,
    absorption: 0.f,
    absorptionColor: color(1.f, 1.f, 1.f));

   


There really needs to be a tutorial video from Substance Designer to Maya 2016 Iray, to prove that this works for making MDL.  >:(

@jaws

So one thing I noticed in your MDL code is that the bitmaps for the MDL aren't being referenced. I've had this issue pop up lately for some reason. I am told there is a fix coming in 5.3.5 for this, but in the mean time here is the work around:

1) Export the MDL preset as usual. If no bitmaps are associated with the export, you will need to export the bitmaps yourself through the export settings in the graph view. Make sure you give them a good name, this is important for step 2!

2) In the code, you will need to reference the names of the bitmaps you exported. Here's an example:
Let's say it's brick_001_basecolor.exr

Your code reads this:
baseColor: ::base::file_texture(texture_2d("" /* tag 3247, version 0 */, ::tex::gamma_default)

It should read this:
baseColor: ::base::file_texture(texture_2d("brick_001_basecolor.exr" /* tag 3247, version 0 */, ::tex::gamma_default),

4) Make sure all the bitmaps are in the same directory as the MDL.

Hopefully this will fix the issue of the glowing glass. Also on that note of the glowing glass, it looks like the code has emissions turned on for some reason. You might want to change the following:

 emissiveColor: color(0.f, 0.f, 0.f),
    emissiveIntensity: 1.f,

to

 emissiveColor: color(0.f, 0.f, 0.f),
    emissiveIntensity: 0.f,

I'm not 100% sure that will work. Make sure the bitmaps are associated and working first before trying that.

I hope this helps!

Hi all,
I work with Daz Studio 4.9 which uses Iray. I have been dabbling with the .mdl files, but more of a hack job.
I want to write my own for use with my creations in Substance but cannot seem to find many resources on the .mdl code even on the Nvidia site.
Can someone please direct me to a really good source documentation please. At the moment i have not had time to dive into substance painter or designer but have been creating my textures via the Bitmap2Material which has been working pretty well for my needs until i have time to get into the other programs. Thanks ahead of time for any help :)

Substance Designer will soon allow you to build MDL materials from scratch withoutthe need to code them, all through a node graph.

Is that in a Substance Designer 5 release, or something coming in a full upgrade?

This will be part of a 5.x update.

Wes (or other MDL gurus)

Is there currently a working method to create a Substance in Designer-->Save it as an MDL--> import and render in Iray Maya 2016 (so that it looks just like the Iray render in Substance Designer).  I feel I've read everything on this subject but versions of these programs are dynamic.  The constant changing workflows might be part of the confusion on my end.  I've posted on another topic but maybe someone could answer my question here.  Currently I cannot even save an MDL from Substance Designer in 5.3.4.  Any assistance would be greatly appreciated.

Thanks
Dave

hello,
i can import for example an nvidia mdl material into SD, but am i able to modify this mdl material? it shows up in iray renderer, but i cant get the material to the editing window.
any help would be cool, jeremie

thanks tomes

No, MDLs created outside of Substance Painter cannot be edited as a graph because they don't contain that graph data in the first place unfortunately.