MDL to Shader Converter

This script generates Shader Presets from MDL files.

Thank you to @Catherine3678ab and @Bejaymac for help with shader bricks!

 

The attached shader networks are generated depending on whether the provided material uses a cutout or not. 

If you have suggestions for improving the shader networks, I would love to hear them!

 

Known deficiencies:

On my system (i5-9600K, 2080 Ti), it takes 6 1/2 hours to process the entirety of vMaterials 1.7.0, most of which is spent rendering the preview thumbnails and creating metadata.

wCutout.jpg
939 x 647 - 89K
woCutout.jpg
939 x 647 - 79K
zip
zip
MDL to Shader Converter.zip
14K

Comments

  • nonesuch00nonesuch00 Posts: 18,142

    thanks

  • AnimAnim Posts: 241

    thanks.

  • jag11jag11 Posts: 885

    I discovered this script recently thanks to this thread https://www.daz3d.com/forums/discussion/528256/nvidia-vmaterials-2-0-0-shader-presets

    I tried it with vMaterials, but noticed it was failing. Reviewed the code and found the script is absolutely brilliant. 

    Found script is failing due to a change in Daz Studio 4.15.1.87. According to Change Log several shader bricks were removed including DzMdlFloat2Input2, which is still referenced internally by Daz Studio, when a vMaterial MDL files requires a float2 as parameter.

    Shader Mixer also fails when on tries to connect User Parameters Brick to a Custom MDL witha float2 as parameter.

    In order make such connection, we need to create a Float2 Brick first, and connect to both User Parameters Brick and the Custom MDL.

    Didn't make corrections to script as I would need to be familiar with the code in order to fix it, but this info might be useful to @Omniflux.

     

     

  • OmnifluxOmniflux Posts: 377

    I need to cleanup some debug code in my current version that has these corrections, but I will try to get it posted soon.

  • jag11jag11 Posts: 885

    Omniflux said:

    I need to cleanup some debug code in my current version that has these corrections, but I will try to get it posted soon.

    Many thanks. 

  • OmnifluxOmniflux Posts: 377

    Attached is an updated version of the script I am using to generate NVIDIA vMaterials 2.1.0 Shader Presets.

    It has updates for a couple DS API changes, resolves some possible memory leaks, solves a shader preset issue (thanks @jag11), adds tiling options to cutouts, and has a few vMaterials 2.1.0 specific changes.

    dsa
    dsa
    MDL to Shader Converter v6.dsa
    52K
  • jag11jag11 Posts: 885
    The script works like charm. Many thanks
  • Silas3DSilas3D Posts: 565

    Sorry for being a noob but I'm not clear how and where one is to use this script - the zips on mega.nz already appear to have shader presets generated?

  • OmnifluxOmniflux Posts: 377

    This script was used to generate those presets and you do not need to use it if you are only looking for those presets.

     

    If you have other mdl files you can use it to generate presets for them. I have posted this script more for feedback and as sample code for working with shader blocks than as a useful tool.

  • SnowSnow Posts: 95

    Thanks a lot for the converter Omniflux!

    Using it now on the v2.3 so hopefully all goes well.

    I'm still on a 4790k so expect it to take a little longer but since it's CPU bound (especially on mac) I can still do other tasks.

    Much appreciated my friend!

  • SnowSnow Posts: 95

    Yikes I did not expect it to take that long! I'm still only 2 folders in so I'll have to force quit later today because I can't even find the stop button.

    Hopefully it does not overwrite previous work because that would make it almost impossible for me to finish this conversion. When it does though I'll make sure to share the presets with you guys.

  • MidzayakiMidzayaki Posts: 4

    If you need help in joint conversion of version 2.3, I am ready to join the work. 

  • MidzayakiMidzayaki Posts: 4

    I've done script conversion of almost all files v2.3.
    These files caused DS to crash and I can't convert them with either the video card or the CPU.

    Fabric

    Cashmere_Wool_Suiting.mdl
    Cotton_Denim.mdl
    Cotton_French_Terry.mdl
    Cotton_Oxford.mdl
    Cotton_Roughly_Woven.mdl
    Cotton_Single_Jersey.mdl
    Cotton_Twill_Gabardine.mdl
    Silk_Georgette.mdl
    Silk_Plain_Chiffon.mdl
    Wool_Melton.mdl
    Wool_Sweater_Knit.mdl

    Metall

    Diamond_Plate_Double_Tear.mdl
    Diamond_Plate_Quadruple_Tear.mdl
    Diamond_Plate_Quintuple_Tear.mdl
    Diamond_Plate_Single_Tear.mdl
    Diamond_Plate_Spike.mdl
    Diamond_Plate_Triple_Tear.mdl
    Punched_Circular_Plate.mdl

  • OmnifluxOmniflux Posts: 377

    Midzayaki said:

    These files caused DS to crash and I can't convert them with either the video card or the CPU.

    This should be resolved in the beta version of DS which uses a newer version of Iray.

  • SnowSnow Posts: 95

    Looks like 2.4 is out. Though I haven't fully converted 2.3 yet I "might" start with 2.4 but it's been a while since I've done this.

    The main issue is the crashes with some of the mdl's which is a pain because we have to skip them and start selecting individual files instead of just converting them all.

    @Midzayaki, I noticed your post just now mate, sorry for the delay! I thought most people weren't interested in this so never thought to check the thread again.

    Why doesn't DAZ create and release these presets (for free obviously) to use in DAZ? It would add a lot of value to the app and user experience.

  • Snow said:

    Looks like 2.4 is out. Though I haven't fully converted 2.3 yet I "might" start with 2.4 but it's been a while since I've done this.

    The main issue is the crashes with some of the mdl's which is a pain because we have to skip them and start selecting individual files instead of just converting them all.

    @Midzayaki, I noticed your post just now mate, sorry for the delay! I thought most people weren't interested in this so never thought to check the thread again.

    Why doesn't DAZ create and release these presets (for free obviously) to use in DAZ? It would add a lot of value to the app and user experience.

    In the new version of DAZ, materials that don't work don't cause the programme to hang, but they don't work either. I use the old conversion. The new conversion probably won't help fix this in any way?


    What is catastrophically missing in all NVIDIA materials is ‘Round Corners Radius’. This part of shader makes the render more realistic and saves polygons. Where can I go to ask for this option to be included in the NVIDIA shader?  

  • OmnifluxOmniflux Posts: 377

    Midzayaki said:

    What is catastrophically missing in all NVIDIA materials is ‘Round Corners Radius’. This part of shader makes the render more realistic and saves polygons. Where can I go to ask for this option to be included in the NVIDIA shader?

    I don't know the proper place to connect the DzMdlStateRoundedCornerNormal brick in the shader mixer. If someone who understands how it interacts with the other bricks better than I do can tell me, then I can add it to the script.

    You can load the existing vMaterials shaders into the Shader Mixer, and add this and other bricks yourself. If you do this, the updated shader should save in your duf file, or you can save a new shader preset to use.

  • StratDragonStratDragon Posts: 3,190

    I have tried to run this script in multiple reboots. I get render failed, then I get render is already in use. I have to keep hitting retry to keep it moving, but I cant do that 3000+ times, and holding it down will minimize window and not retry. HELP!

Sign In or Register to comment.