Batch converting to rxgb?

is there a example of this?

dtx5 rxgb I mean

Hi @y2keeth! We’ve just released NVIDIA Texture Tools Exporter 2023.3.0, which adds support for reading and writing DXT5 RXGB files. It’s listed as BC3n AGBR 8 bpp | aka RXGB (DXT5) in the Format dropdown:

It’s also available in the nvtt_export standalone version’s command-line interface as the bc3n-rxgb format:

nvtt_export input.png --format bc3n-rxgb --output output.png

There’s a couple of ways to batch-convert a set of files.

Photoshop Actions

In the Photoshop plugin, one way is to record an action and then use Photoshop’s Automate > Batch...:

  • Load an image.
  • Open the Actions window (Window > Actions) and click the icon that looks like a plus in a square at the bottom of the window to create a new action:

image

image

  • Click Record to start recording.
  • Save the image as an RXGB DDS file: Click on File > Save a Copy, navigate to your output folder, change “Save as type” to “DDS - NVIDIA Texture Tools Exporter”, and click Save. Then in the Exporter window, set “Format” to BC3n AGBR 8 bpp | aka RXGB (DXT5) and click Save.
  • Back in the Photoshop Actions window, click the stop button to stop recording:

image

You should now have an Action that looks like this:

image

  • Now let’s apply this to a folder of images! In Photoshop, go to File > Automate > Batch… . Then set “Action” to “Save as RXGB”, and set your Source folder. Also, set Destination to Folder, choose your destination folder, and check “Override Action ‘Save As’ Commands”.

Then click OK. You should see Photoshop load each file and run the Save As RXGB command.

Python Scripting

If you have the standalone version and Python installed, here’s a quick Python script you can run that will load all PNG files in a folder and save them as DDS RXGB files. It reads the folder name from the command line - so if you saved this as convertPNGToRXGB.py, you’d run this using python3 convertPNGToRXGB.py "path/to/folder-you-want-to-convert" on the command line.

import os
import subprocess
import sys

dirName = sys.argv[1] # Get the name of the folder passed to this script
print(f'Creating batch script for directory {dirName}')

filesInDir = os.listdir(dirName) # Get all files in the directory
filesInDir = [f for f in filesInDir if f.lower().endswith('png')] # Get only PNG files
filesInDir = [os.path.join(dirName, f) for f in filesInDir] # Get absolute paths
filesInDir = [f for f in filesInDir if os.path.isfile(f)] # Ignore directories

outScript = open('convertPNGToRXGB.nvtt', 'w') # Start a new script

for file in filesInDir:
  newFileName = file.rpartition('.')[0] + '.dds' # Replace .png with .dds
  outScript.write(f'{file} --format bc3n-rxgb --output {newFileName}\n')

outScript.close()

print('Running nvtt_export --batch convertPNGToRXGB.nvtt...')
subprocess.run([r'C:\Program Files\NVIDIA Corporation\NVIDIA Texture Tools\nvtt_export.exe', '--batch', 'convertPNGToRXGB.nvtt'])
print('Done')

Hope this helps!

wow thats great going to check it out
thanks

quick question is there a higher setting for the quality setting?
“-quality normal”
how high can it go?

Thank you @y2keeth!

--quality can be fastest, normal, production, or highest – or the equivalent numeric values, 0, 1, 2, or 3.

You can find documentation about all of nvtt_export’s command-line options by running nvtt_export --help, which will print text like this:

NVIDIA Texture Tools Exporter 2023.3.0
Usage: nvtt_export [OPTIONS] [input-file]
...
  -q,--quality ENUM:{fastest->0,highest->3,normal->1,production->2}
                              Sets the quality vs. speed of the texture compressor, from fastest to normal to production to highest (default: normal). Note that values of and above "production" can be very slow.

Hope this helps!

great thanks
hopefully i can get it installed soon
having issues installing asks me to uninstall the old version but gives me a error when I try to uninstall the old one

Oh, interesting! It looks like the legacy version’s uninstaller is crashing.

Worst-case, if you go to C:\Program Files\Adobe\Adobe Photoshop [version you are installing to here]\Plug-ins\FileFormats and delete dds64.8bi, that should be equivalent to uninstalling the legacy version – let me know if that works!

yes that seamed to work it installed the plugins nvtt folder
but noticed it didn’t replace the file formats I deleted

Hi @y2keeth! I believe that’s normal; the plug-in changed its location in 2019 from FileFormats\dds64.8bi to NVTT\nvtt_export.8bi. Or, do you mean some other formats from the Photoshop Save a Copy... menu are now missing?

Thanks!

–Neil

ok thanks goin to try it soon here

getting a error saying it cant read image
when i try to load the dds i created back into photoshop

one more question does the x channel have the alpha?

Hi @y2keeth! Normally, load errors on DDS files happen when a different plugin tries to read the file before the Texture Tools Exporter has a chance to (e.g. if the legacy dds64.8bi plugin is installed, it usually tries to load DDS files first and then throws an error, and the newer version doesn’t get a chance to try). I’m not sure if that’s happening here, though – Photoshop’s error message doesn’t have much information here.

Worst case, could you try loading the DDS into the standalone version? That should avoid issues with different plugins clashing, and you can export the loaded DDS there to the file format of your choice and then load that into Photoshop.

Yep! The RXGB format turns out to be the same as regular BC3n, except the red and alpha channels are swapped before compression. That’s why it’s labeled “BC3n AGBR aka RXGB” in the Texture Tools Exporter: because it takes (r, g, b, a) to (a, g, b, r), and then BC3 compresses it. The RXGB decompressor performs BC3 decompression, and then swaps the red and alpha channels back.

Here’s the full documentation text on it that shows when you hover over the format name:

Saves the image using BC3 texture compression with a color transformation
designed for normal maps. This is like BC3n, except instead of transforming
the color (r, g, b, a) to (1, g, 0, r), it transforms it to (a, g, b, r).
Then it compresses the result using BC3.

The RXGB name does not follow the convention of other formats: it would be
named AGBR if it was listed in byte order. However, this format’s
better-known under the RXGB name.

Hope this helps!

yes they load in the stand alone thanks again

was going great then certain tga files cause everything to freeze up photoshop like this one tried several times
autopsy_d.7z (27.4 MB)

converted them to png to try it, now photoshop just crashes closed no error
also tried to convert that .tga I shared single and it freezes up i am at a loss

tried it in the stand alone and got this dds that wont load back into the stand alone and is 0 bytes
autopsy_d.7z (98 Bytes)

Hi @y2keeth – that’s interesting, thank you for reporting this issue!

By any chance, are you using version 2023.3.0? We fixed a crash bug that occurs with the BC1-BC3 compressors on some GPUs – the fix is in version 2023.3.1, which we released on Friday (NVIDIA Texture Tools Exporter 2023.3.1 / NVTT 3.2.3 Released). If you re-download the installers from Texture Tools Exporter | NVIDIA Developer, you should get the new 2023.3.1 version!

If you’re already using 2023.3.1, could you send me your system info by running dxdiag, clicking “Save All Information…”, and sending me the text file it generates either here, over a DM, or by emailing it to nbickford@nvidia.com?

Thanks!

–Neil

using 2023.3.0, downloading that version now
do i have to remove the old one?