Graphic File Related Tasks and Tools

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pwillard
    3000 Post Veteran



    • Nov 1999
    • 3070
    • Cumming Ga
    • ORTS

    #1

    Graphic File Related Tasks and Tools

    A while back, around January 2025, Scott Brunner compiled and released code written by David Webb. It is a command-line tool that helps batch convert Ace files into BMP files for editing. With it, you could process whole directories at once. It's pretty handy if that's the sort of thing you want to do and you are not afraid of the command line in Windows.

    But it got me wondering... what if we had something to go the other way? A tool that would convert files (or folders) from TGA, BMP, or PNG files into DDS (DXT3 / BC2_UNORM_SRGB) using an existing program called "texconv.exe", from the legacy DirectX SDK. The program is concise and complex, but if it had a nice wrapper that made it worthwhile for *our* purposes, would that be useful?

    For example, converting to DDS:

    1) Single file (any supported type)
    ts_tex2dds.exe mytexture.png
    ts_tex2dds.exe mytexture.bmp
    ts_tex2dds.exe mytexture.tga

    2) Whole tree of mixed PNG/BMP/TGA → DDS in-place
    ts_tex2dds.exe textures/

    3) Whole tree → DDS into separate folder
    ts_tex2dds.exe textures/ -o textures_dds

    4) Explicit texconv location
    ts_tex2dds.exe textures/ -o dds_out --texconv "C:/Tools/DirectX/texconv.exe"

    ... And rather than have a slew of command line options... There are only a few since we know the environment these files are used... but there is a " --srgb" option if you need the extra gamma related to that option (technically, we don't, so that's not a default)

    I actually have this Train Sim specific "texconv" wrapper compiled as an exe file... I'm just not sure if I'm the only one who wants it or needs it.
    http://www.railsimstuff.com
    Just Blender now, 3DCrafter only when I have to.
    Formerly The Keystone Works (All Permissions Granted)
    Things I work on: https://github.com/pwillard
  • pwillard
    3000 Post Veteran



    • Nov 1999
    • 3070
    • Cumming Ga
    • ORTS

    #2
    Ok, I guess it *is* just me. Oh well.
    http://www.railsimstuff.com
    Just Blender now, 3DCrafter only when I have to.
    Formerly The Keystone Works (All Permissions Granted)
    Things I work on: https://github.com/pwillard

    Comment

    • SD40-2
      1000 Post Veteran


      • May 2010
      • 1011
      • Metairie, Louisiana
      • English, C++, HTML
      • General

      #3
      Pete,

      I think this is very interesting, and could have some uses, especially for route builders who need to batch-convert multiple textures.
      Parker B. - A Misplaced Midwesterner.
      Also known as Mr. Two Bits and Mr. Squarewheels.

      Comment

      • scottb613
        2500 Post Veteran


        • Apr 2003
        • 2848
        • Downeast Maine (soon)
        • ORTS

        #4
        Hi Pete,

        Very cool - only issue I found with David's tool - was you can't process files with Alpha Channels.

        We are sorely in need of better tools.

        Regards,
        Scott
        Last edited by scottb613; 11-10-2025, 11:03.
        <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

        Comment

        • eric
          9500 Post Veteran and Administrator



          • Dec 2002
          • 9583
          • NS MP245.4 CNO&TP South District
          • English, SQL
          • General

          #5
          I would definitely consider breaking with the ace format if I could convert my library of reusable tiled textures in one very long action...
          If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

          Comment

          • pwillard
            3000 Post Veteran



            • Nov 1999
            • 3070
            • Cumming Ga
            • ORTS

            #6
            Ah, and I was trying to augment what was already available. Also, I thought I read somewhere recently that OPENRAILS has an AceToTga tool. As the name suggests, this is a tool for converting Ace files to Tga files, which know how to handle Alpha. (Maybe that's a future release though... )

            Howevah.....

            I just used PYTHON to convert an MSTS ACE file to PNG, and this is the result... So, yes... we can have a command-line ACE to PNG conversion that preserves the alpha channel while converting... (Just to be clear, this is the PNG file after conversion from ACE)

            image.png

            So, I suppose we now have a potential migration path with command-line tools. It's still rough and probably has bugs... but I can call it progress, I guess. And yes, jeez, I wish I had been able to do this eons ago.

            My biggest concern is that there is SOURCE CODE available for any solution generated because... everything rots if it is not maintained or is not built to be maintainable. Sure, executables can be produced for ease of use, but Python source will be provided where possible.

            So what I'm thinking... 2 tools... 1. ACE --> PNG (edit as needed) 2. PNG --> DDS …with complete control to mess with the PNG in the middle step.

            Step 1) Sample Run

            Code:
            C:\tools>ace2png "c:\tools\trainset\us2freight8"
            [INFO] Found 3 .ace file(s). Converting...
            c:\tools\trainset\us2freight8\7TRUCK1.ACE -> c:\tools\trainset\us2freight8\7TRUCK1.png (256x256)
            c:\tools\trainset\us2freight8\freight8.ace -> c:\tools\trainset\us2freight8\freight8.png (60x30)
            c:\tools\trainset\us2freight8\us2freight8.ace -> c:\tools\trainset\us2freight8\us2freight8.png (512x512)
            [INFO] Done. 3/3 converted.
            It appears to be capable of processing approximately 100 ACE files to PNG conversions per minute, possibly less time. I just converted 543 files in the texture folder of the Blue Ridge route with no errors, including all the special subdirectories for weather and nighttime, using a single command. I'm calling this one ready to share.

            Last edited by pwillard; 11-10-2025, 17:17.
            http://www.railsimstuff.com
            Just Blender now, 3DCrafter only when I have to.
            Formerly The Keystone Works (All Permissions Granted)
            Things I work on: https://github.com/pwillard

            Comment

            • pwillard
              3000 Post Veteran



              • Nov 1999
              • 3070
              • Cumming Ga
              • ORTS

              #7
              And finally, something to mess with.

              https://github.com/pwillard/Ace2DDS the repository

              https://github.com/pwillard/Ace2DDS/releases for a zip file with the executables

              For those curious, the DDS program utilizes https://github.com/Microsoft/DirectXTex/releases (although I'm not using/including a recent version of this file, as I've had it on my PC for a while. The one from the website does work, however, if you download it.)
              Last edited by pwillard; 11-11-2025, 07:04.
              http://www.railsimstuff.com
              Just Blender now, 3DCrafter only when I have to.
              Formerly The Keystone Works (All Permissions Granted)
              Things I work on: https://github.com/pwillard

              Comment

              • pgroenbaek
                Member
                • Jan 2024
                • 98
                • Denmark
                • ORTS

                #8
                Thanks for making these two utils Pete, will definitely come in handy for automated texture processing.

                I had thought about using the ace2bmp utility by David for this purpose, but if that does not support alpha channels properly then using that is not really an option for me.
                - Peter

                Route Projects: DK24
                Utilities and Tools: ShapeIO, ShapeEdit, TrackshapeUtils

                Comment

                • MK Inst
                  New Member
                  • Apr 2025
                  • 1
                  • General

                  #9
                  Thought I'd chip in with my own two cents in case it's useful to anyone, having been trying to figure out the best way to extract the vanilla assets - a few of the more heavily-compressed .ace's (i.e. most of them) seem to come out differently depending on the extractor used, which can be really annoying. Attached are a couple comparisons with the 310 and Acela, along with the uncompressed ones found in the SAMPLES folder - you can see that the ones using TGATool2A come out with a bit of a greenish tint and the compression artefacts emphasised slightly. TrainSimFileViewer does better and gets much closer to the true colours, but it tends to misread the texture offsets or mess up the transparency. I had a friend run the Acela through TrainSimRouteExplorer5's extractor for me too as I couldn't run it on my OS, but it appears to fix both of the former issues, with the alpha intact.

                  Likely the script TSRE5 is using is the one to go with but it might be a little tricky to run as as far as I'm aware it doesn't currently work as a standalone batch converter, which means converting things with no associated 3D model like the ground textures etc can be a pain.
                  Attached Files
                  Last edited by MK Inst; 12-25-2025, 05:14.

                  Comment

                  • pgroenbaek
                    Member
                    • Jan 2024
                    • 98
                    • Denmark
                    • ORTS

                    #10
                    Originally posted by MK Inst
                    ... you can see that the ones using TGATool2A come out with a bit of a greenish tint and the compression artefacts emphasised slightly.
                    Quite interesting to see that there's that big of a difference between TGATool2A and GokuMK's tools. Good to know.
                    - Peter

                    Route Projects: DK24
                    Utilities and Tools: ShapeIO, ShapeEdit, TrackshapeUtils

                    Comment

                    • pwillard
                      3000 Post Veteran



                      • Nov 1999
                      • 3070
                      • Cumming Ga
                      • ORTS

                      #11
                      FYI: I am still refining the PNG2DDS conversion, since it's currently producing DDS files that TSRE Shapeviewer doesn't like.
                      http://www.railsimstuff.com
                      Just Blender now, 3DCrafter only when I have to.
                      Formerly The Keystone Works (All Permissions Granted)
                      Things I work on: https://github.com/pwillard

                      Comment

                      Working...