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,929

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

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

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

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

    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.

Sign In or Register to comment.