Don't trust PVRTexToolCLI or PVRTexToolGUI handling of sRGB

This is using the April 2020 release of PVRTexToolCLI (Build 4.23) and GUI (Build 20.1) on macOS 10.15.6. The samples shown are ASTC4x4 encoded 4x4 textures and I’m using astcenc.

I’m only able to visually verify this content is correct off the preview thumbnail (which mostly looks like the texture in the upper left), since KTX thumbnails in macOS don’t handle sRGB. PVRTexToolGUI gives totally different results from Preview for the PNG and KTX file. My display is set to sRGB as well.

DCM (digital color management tool) says the following for red:
Preview PVRTexToolGUI
png 64 13
ktx 136 64

AttribSimple
Your website doesn’t allow upload of KTX format files, so this is the command to process that file.
PVRTexToolCLI -f ASTC_4x4,UBN,sRGB -i AttribSimple.png -o AttribSimple.ktx

sRGB handling should purely affect mipmap generation where srgb to linear conversion occurs at higher than 8-bit depth, mips are filtered, converted back to 8-bit sRGB, and then sent to encoder. Ideally higher bit depth linear pixels would be sent to encoding, and endpoints converted back to sRGB after fitting the point cloud, but that is more involved and difficult with 565 encodings like BC1-3.

It looks like 4.24 significantly improves the sRGB handling over 4.23. The results still don’t match the png file. I read a red of 68, and a red of 64 in the original png file from DCM, but I’ll try the comparison tool. This is DCM + Preview + Display set to SRGB. Also cuttlefish also gens a red of 68, so it could just be Preview handling the KTX pixels differently.

The PVRTexToolGUI was from the 4.24 release, so that still has dark colors as reported elsewhere on the forums.

Hi, alecazam123,

We’re aware of an issue in PVRTexTool 4.24 where the image displayed in the PVRTexTool GUI viewer appears darker than it’s supposed to.

Our internal investigation found out that:

  • PVRTexTool 4.23 may display correctly, but the values contained are actually incorrect (too bright).
  • PVRTexTool 4.24 encodes the correct values in the texture, but the viewer (and only the viewer) is too dark.

You can find a more detailed explaination about the issue in this Github Issue.

We’re planning on releasing a fix for this issue in the 20.2 release in the meantime we recommend using PVRTexTool 4.24.

Thank you.
Regards,
Omar.