KTX files are texture files used on mobile. Beamdog converted the base game files to KTX for that dataset. They sorta-kinda work on desktop but see notes below. They might also not work perfectly on mobile to be honest due to same issues.

Due to the specification it's not recommended to use them over DDS which especially for PBR files have much more optimal versions for space/efficiency/quality.

KTX Specification

The version the game loads is the ETC2 compression version used for OpenGL ES 3.0. This is a KTX1 texture format (the file name needs to be filename.ktx for the game to load it). ETC2 is similar to the BC type compression found in DDS files, as in it is the same size for each resolution.

The game only loads RGB and RGBA versions. This means no R or RG versions (well it tries to load them, but incorrectly as RGB or RGBA) so there is no efficiency saving for normal or spec/roughness maps. Even for basic normal maps they'll be much larger due to 3 channels. There is also no sRGB support, which is a higher quality version.

They load fine if set properly as per the tools below, but only as a 3 channel RGB (or 4 channel RGBA, although not many reasons to use alpha in textures nowadays in NWNEE) but this is very space inefficient compared to DDS.

These are the types for OpenGL ES 3.0 with notes:

File SpecificationDefinitionNWN EE Notes
GL_COMPRESSED_R11_EAC11 bits for a single channel. Useful for single channel data where higher than 8 bit precision is needed. For example, heightmaps.
GL_COMPRESSED_SIGNED_R11_EACSigned version of GL_COMPRESSED_SIGNED_R11_EAC, useful when signed data is needed.
GL_COMPRESSED_RG11_EAC11 bits for two channels. Useful for two channel data where higher than 8 bit precision is needed. For example, normalised bump maps, the third component can be reconstructed from the other two components.
GL_COMPRESSED_SIGNED_RG11_EACSigned version of GL_COMPRESSED_RG11_EAC, useful when signed data is needed.
GL_COMPRESSED_RGB8_ETC28 bits for three channels. Useful for normal textures without alpha valuesThis is the standard non-alpha texture format NWNEE reads
GL_COMPRESSED_SRGB8_ETC2sRGB version of GL_COMPRESSED_RGB8_ETC2
GL_COMPRESSED_RGBA8_ETC2_EAC8 bits for four channels. Useful for normal textures with varying alpha values

This is the alpha texture format NWNEE reads

The game defaults to 0.5 alpha mean values for KTX textures.

GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EACsRGB version of GL_COMPRESSED_RGBA8_ETC2_EAC
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC28 bits for three channels and a 1 bit alpha channel. Useful for normal textures with binary alpha valuesPunchthrough is not supported explicitly.
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2sRGB version of GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2.Punchthrough is not supported explicitly.

KTX Issues

There are two main issues:

  • KTX files are space inefficient since the 1 and 2 channel options are not able to be used
  • Mobile version of the game will translate DDS files to KTX but seems to bug out since it only knows RGB/RGBA not 1 or 2 channel formats. This however needs further testing.

So you either have space efficient DDS files for majority of players and mobile players lose out or have KTX and waste a lot more space with 3 channel files when 1 or 2 would do.

KTX Tools

There are some tools used to test the game files for ETC2:

  • kram - command line converter. Can generate ETC2 files from PNG, much faster than other options.
  • ARM Mali Texture Compression Tool - This is now abandonware thus the link to the internet archive. Good side by side comparison and simple ETC2 selection if a bit weird UI. Very slow however!
  • PVR Tex Tool - I think can do ETC2 it's not quite clear from the config but posting just in case it's useful.

KTX2

Currently the follow on KTX2 format which has advanced algorithms to do smaller efficient files, with compression to boot, are not supported by the game. This would have been an improvement possibly on using DDS files in general!

Mainly this means more modern KTX tooling is geared towards this meaning the KTX Tools and NVIDIA tools and others are not going to work on NWNEE alas.

  • No labels