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: 17,990

    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: 366

    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: 366

    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: 558

    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: 366

    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: 3

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

  • MidzayakiMidzayaki Posts: 3

    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: 366

    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.

Sign In or Register to comment.