Announcement

Collapse
No announcement yet.

Tool to update old material libraries to v6 standards

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tool to update old material libraries to v6 standards

    ​As V-Ray introduces new features and defaults with each iteration, old material (pun intended) may be left behind.
    For example, the new energy conservation for GTR/GGX is turned on only for new materials, and it has no UI control to toggle it.
    This is a problem if one has old material libraries, for example, they take materials from to add to new scenes.
    The attached script aims to process .mat and .max files so to toggle such options (see the screenshot).

    Usage:
    a) Pick a Path to scan (it will recurse through sub-paths.) for .mat and .max files, or choose "work on the open scene" instead.
    b) Toggle off the options you don't want
    c) Press "Go!" and wait (a few seconds for matlibs, more for Max files.).

    Warnings:
    a) The script is given as-is, without any guarantee of support or improvements.
    b) The script by default appends the max version to the saved files. The behaviour can however be toggled off, thereby enabling file overwriting. This is very risky (see point c) ) and shouldn't be used on the original files. To be clearer: make a copy of the files before processing them.
    c) The process will set the version of matlibs/max files to the version of Max used to process them.
    In other words, matlibs or max files saved with max 2023 will not open again in max 2022.
    Particularly for older stuff: make a copy!
    d) Max files can be opened either as matlibs (processing is super quick this way) and will then create a matlib as a result (maxfilename.mat) saved side-by-side, the original max files are left untouched, or as Max files proper (processing of these can be several times longer, depending on scene complexity.), and then by default a new version of the original max file will be created.
    e) The switch of BRDF to GGX is naively done, there is currently no attempt at matching glossiness amounts. Looks *will* change (as it's the goal of the whole task.).
    f) The legacy (typically mentalRay) custom attributes are detected and cleaned using Max's own scene converter. If it creates issues for you, turn it off.

    Script version is 0.02 adds processing of just the open scene.
    It also allows to add the Max version as token to the saved matlib (so old ones stay the same, and it future-proofs trying to open them.) as well as a custom string instead.

    Script version 0.03 adds the processing and saving of max files as max or mat files, thereby creating (or overwriting. change defaults at your peril!) new max files or new mat files as the user chooses.

    Script version 0.05 strenghtens the holding/fetching of max files, and adds conversion of bitmap loaders to vrayBitmap ones using the tried and tested functions that come with V-Ray.

    Script version 0.07 adds the resetting of map coordinates' blur to 1.0 (only works on Max files treated as scenes. Won't touch matlibs.), and also turns on the new anisotropy model along with Energy conservation (the highlight will not turns into anisotropic, however.).
    There is also a fix for a potential corner-case bug (that was not reported, however.).

    Script and screenshots have been updated.

    Click image for larger version  Name:	image.png Views:	0 Size:	18.6 KB ID:	1166502Click image for larger version  Name:	image.png Views:	0 Size:	16.6 KB ID:	1166503​​
    Attached Files
    Last edited by ^Lele^; 29-11-2022, 05:00 AM.
    Lele
    Trouble Stirrer in RnD @ Chaos
    ----------------------
    emanuele.lecchi@chaos.com

    Disclaimer:
    The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

  • #2
    Thanks for sharing !
    would it be easy to add an option to do these changes to the current scene materials directly too ?
    I usually use VMC script to do this process manually to each property one by one, but a one click solution will be great too.
    Thank you .
    Last edited by M.Max; 12-08-2022, 07:45 AM.
    -------------------------------------------------------------
    Simply, I love to put pixels together! Sounds easy right : ))
    Sketchbook-1 /Sketchbook-2 / Behance / Facebook

    Comment


    • #3
      Ah nice, we started updating our inhouse library so can use this aswell! Thanks.

      Comment


      • #4
        Originally posted by M.Max View Post
        Thanks for sharing !
        would it be easy to add an option to do these changes to the current scene materials directly too ?
        I usually use VMC script to do this process manually to each property one by one, but a one click solution will be great too.
        Thank you .
        I have something else that processed open scenes (it's substantially simpler compared to matlibs).
        Not sure i should just add the "work only on open scene" option to this one.
        Would it work this way?
        Lele
        Trouble Stirrer in RnD @ Chaos
        ----------------------
        emanuele.lecchi@chaos.com

        Disclaimer:
        The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

        Comment


        • #5
          Thanks for the suggestion, Max, i updated the first post with the new script and screenshots.
          Lele
          Trouble Stirrer in RnD @ Chaos
          ----------------------
          emanuele.lecchi@chaos.com

          Disclaimer:
          The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

          Comment


          • #6
            Originally posted by ^Lele^ View Post
            Thanks for the suggestion, Max, i updated the first post with the new script and screenshots.
            Wow that was fast! Thank you so much!
            I will test it later and report back if I find any issue/suggestions.
            -------------------------------------------------------------
            Simply, I love to put pixels together! Sounds easy right : ))
            Sketchbook-1 /Sketchbook-2 / Behance / Facebook

            Comment


            • #7
              Script version 0.03 adds the processing and saving of max files as max or mat files, thereby creating (or overwriting. change defaults at your peril!) new max files or new mat files as the user chooses.
              Script and screenshots have been updated in the first post.
              Lele
              Trouble Stirrer in RnD @ Chaos
              ----------------------
              emanuele.lecchi@chaos.com

              Disclaimer:
              The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

              Comment


              • #8
                Does this also take care of mismatchin reflection and specular glossiness (which was possible many versions ago).
                I know it is ignored these days, but V-Ray still prints a warning about this in the log.
                https://www.behance.net/Oliver_Kossatz

                Comment


                • #9
                  It doesn't, no, because the materials are anyway ignored non-destructively by V-Ray itself.
                  For the script to make the error disappear, it'd have to wipe the contents of the specular section, thereby potentially dropping textures.
                  Lele
                  Trouble Stirrer in RnD @ Chaos
                  ----------------------
                  emanuele.lecchi@chaos.com

                  Disclaimer:
                  The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                  Comment


                  • #10
                    Hi Lele,
                    I just finished moving our library into the V-ray Material Library Browser using the V-ray companion tool. Using your script I managed to generate a new .mat library file with all materials updated to the current standards. There is only one thing I can't wrap my head around do to my almost zero maxscript knowledge. We have a lot of old materials that still use the legacy Max Bitmap and I wanted to convert them to V-ray Bitmaps. What would be the easiest way of doing this? I tried to search for a script that would import all the materials from the .mat file inside Max so that I could use the V-ray converter but could not find anything usable.
                    Thanks in advance!
                    pixel bender @ panoptikon

                    Comment


                    • #11
                      You're right, and in the right place.
                      That's the planned upgrade for the script above.
                      Lele
                      Trouble Stirrer in RnD @ Chaos
                      ----------------------
                      emanuele.lecchi@chaos.com

                      Disclaimer:
                      The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                      Comment


                      • #12
                        Script version 0.05 strenghtens the holding/fetching of max files, and adds conversion of bitmap loaders to vrayBitmap ones using the tried and tested functions that come with V-Ray.
                        Script and screenshots have been updated in the original post.
                        Lele
                        Trouble Stirrer in RnD @ Chaos
                        ----------------------
                        emanuele.lecchi@chaos.com

                        Disclaimer:
                        The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                        Comment


                        • #13
                          Originally posted by ^Lele^ View Post
                          Script version 0.05 strenghtens the holding/fetching of max files, and adds conversion of bitmap loaders to vrayBitmap ones using the tried and tested functions that come with V-Ray.
                          Script and screenshots have been updated in the original post.
                          Awesome, thanks Lele!
                          pixel bender @ panoptikon

                          Comment


                          • #14
                            You're welcome, most of the work was already done by others.
                            Please report any issue you may have!
                            Lele
                            Trouble Stirrer in RnD @ Chaos
                            ----------------------
                            emanuele.lecchi@chaos.com

                            Disclaimer:
                            The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                            Comment


                            • #15
                              Thank you LeLe

                              Comment

                              Working...
                              X