Announcement

Collapse
No announcement yet.

Converting Textures to tiled .TX format with V-Ray (3.x to 6.x). Guide + Scripts.

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

  • Converting Textures to tiled .TX format with V-Ray (3.x to 6.x). Guide + Scripts.

    While Next got the tools for the .TX workflow it needed right into the basic installation, 3.x needs a bit of attention to get it to work.
    This thread aims to detail the steps, and provide the tools for, the conversion of a scene's texture, or disk archive, to .TX files, loaded through VRayHDRI maps.

    A) You should have "makeTX.exe" in the v-ray bin folder. It should be enough to have V-Ray correctly installed.

    B) Use this script to convert the textures on disk to .TX format.

    Because the script analyses a folder and subfolders recursively, attention should be paid to the location of the scene's textures, to avoid lengthy conversion processes.
    If you already had the textures converted to .tx, side by side with the original files, then you can skip this step.
    The script will try and find makeTX by itself, and if it doesn't (as is the case for 3.x) it will offer inputting a path manually.
    In that case, point it to the path as per point A) above.

    C) Open a scene, and use the right-mouse click menu utility called "V-Ray Bitmap to VRayHDRI converter".
    As the dialog comes up, press "convert" without checking any box.
    This will convert all the scene's shaders' bitmaps to VRayHDRI loaders, preserving gamma.
    Notice this part can be fairly slow, because to know a max bitmap's gamma, one needs to *open* the file, to then query the Max setting.
    This will produce storage/network activity, and potentially take quite a long time, but it will spare us from having to fix the gamma values manually later, so overall it's a huge saving.

    D) Use this script on the open scene to change the VRayHDRI loaders (only!) to .TX.
    TXSwapper_002.zip
    Notice the script assumes that the .TX files are in the same folder of (i.e.: side-by-side with) the original textures.
    Running it in quick mode without that condition satisfied will produce a stream of "file not found" errors in the asset tracker, while running the script in safe mode will swap no texture out at all.

    E) Render. If the scene worked as expected, you can now delete the source textures, should you wish to do so.

    EDIT: makeTX_batcher_006.zip has fixed the issue with the ini file and manual maketx.exe search. It also adds the --unpremult and the --hicomp options.
    EDIT: makeTX_batcher_008.zip Added multi-threading with four threads. It should be considered a testing version. I've prettied up the listener prints (now also with the size of the file being processed, and all decimal places limited to 2), made the dos window invisible (Thanks Vlado!), and added cancelling messages.
    To cancel, simply have the script selected, and stand on the ESC key. Some threads may take longer to stop as they are processing, and i can't currently quit them mid-work.
    Attached Files
    Last edited by ^Lele^; 30-12-2022, 02:45 PM.
    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
    Updated to work with V-Ray 6.x
    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


    • #3
      makeTX_batcher_006.zip has fixed the issue with the ini file and manual maketx.exe search. It also adds the --unpremult and the --hicomp options.​
      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


      • #4
        Hi Lele,

        This script does it utilize multithreading or does it just go through one texture at a time?
        Dmitry Vinnik
        Silhouette Images Inc.
        ShowReel:
        https://www.youtube.com/watch?v=qxSJlvSwAhA
        https://www.linkedin.com/in/dmitry-v...-identity-name

        Comment


        • #5
          It's single threaded, one image per spawned process. Could be done with a deadline command line job if you wanted to thread it, or find <> | xargs -P etc.

          Comment


          • #6
            It could surely be made to output batch files, but i am unsure if it'd go any quicker that way.
            You can always run multiple max instances, and a script per folder, f.e.

            EDIT: nvm, i'm looking into multithreading the script itself via dotnet.
            Last edited by ^Lele^; 30-12-2022, 06:49 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.

            Comment


            • #7
              EDIT: unnecessary now.
              Last edited by ^Lele^; 30-12-2022, 01:22 PM.
              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
                Awesome. Will check it out. Yeah, the focus stealing was an issue with just the one thread. I can only imagine four.

                Comment


                • #9
                  I have a fix for the focus stealing, but thread stopping has so far proven exceptionally capricious.
                  The dotNet documentation doesn't specify the stuff i'd need, the MXS one neither, i'm left with trial and crash to desktop.
                  I may need more time to come up with a clever way to stop them all, maybe with progress passing, who knows.
                  Alas, the threading makes Max *extremely* unstable.
                  Ensure you don't run it while a production scene is open.
                  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
                    makeTX_batcher_008.zip​ Added multi-threading with four threads. It should be considered a testing version.
                    I've prettied up the listener prints (now also with the size of the file being processed, and all decimal places limited to 2), made the dos window invisible (Thanks Vlado!), and added cancelling messages.
                    To cancel, simply have the script selected, and stand on the ESC key.
                    Some threads may take longer to stop as they are processing, and i can't currently quit them mid-work.
                    Sometimes, it will even print out that no threads have been left active.
                    Closing the script will once again call quit to all four threads, just like the manual cancelling, and then all makeTX instances should stop.

                    It can be found in the Original Post
                    Last edited by ^Lele^; 30-12-2022, 02:40 PM.
                    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


                    • #11
                      Thanks, ^Lele^ I am getting a 404 on the link to the zip file.

                      Comment


                      • #12
                        Sorry for that, i'll relink it in the OP.
                        EDIT: Forum's playing up a bit.
                        It seems to be working right now, find it in the list of attached files in the OP.
                        Last edited by ^Lele^; 30-12-2022, 02:46 PM.
                        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
                          Hi, one question: V-Ray's native "Bitmap to V-Ray Bitmap-Converter" only seems to convert textures to tx if the starting point is a standard 3ds Max Bitmap. It doesn't do anything if the starting point is a V-Ray Bitmap already. Is there a recommended way to convert scenes that use VRayBitmaps already but no .tx textures to tx with a single click? Or would I need to batch create all the .tx files and then manually replace them? What's the recommended workflow to convert existing scenes to tx that requires minimum effort?
                          Check out my FREE V-Ray Tutorials

                          Comment


                          • #14
                            use my scripts.
                            The behaviour has been the same for over a decade now (with tiled EXRs before it), and so have been my various scripts.
                            The swapper in the OP ought to do what you need, so long as you have the tiled files side by side with the original ones.
                            Feel free to edit the script (it's nearly natural language) should you want a different path to search for tiled textures in.

                            When the new scene converter will be ready, this will also be taken care of, of course.
                            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
                              Awesome, thx I oversaw the swapper! That is very appreciated!
                              So since there seems no way to automatically just convert the texturefiles I have in my scene and I would I would want to manually convert only specific textures using maketx.exe can I use following command line arguments?

                              --opaque-detect --constant-color-detect --fixnan box3 --oiio -v -u --oiio --filter lanczos3 %%i

                              I got this from an Arnold Forum so just want to confirm if that everything is also supported in V-Ray. Or if not which would be the recommended command line arguments to convert a texture?

                              Also I have issues that sometimes when loading tx files it pops up a window in my scene. It seems to render fine though. So I'm not sure if something goes wrong during the conversion.


                              Check out my FREE V-Ray Tutorials

                              Comment

                              Working...
                              X