NWN crunch is a command line tool for texture compression, based on the unity fork of crunch.
NWN crunch uses the zlib license: https://opensource.org/licenses/zlib-license.php



################
# Introduction #
################

NWN crunch itself is a command line tool, but ofeers some scripts for the most common operations
with NWN.
- All scripts will read files from the "in" directory and write files to the "out" directory
- The directory structure from the "in" folder will be re-created in the "out" folder.
- Supported file formats: png, tga, bmp, jpeg, dds (standard and NWN), ktx, crn



###########
# Scripts #
###########

convert_dds

Converts all files to (standard) dds format.
Compression options are chosen based on file suffix:
_d  =>  Diffuse Texture
_n  =>  Normal Map
_s  =>  Specular Map
_m  =>  Metallicness (converted to specular)
_r  =>  Roughness
_g  =>  Glossisness (converted to roughness by inverting)
_h  =>  Height/Displacement
_i  =>  Illumination
Files without suffix are interpreted as diffuse maps.
The default delimiter "_" can be changed in the settings.ini, see below.


convert_dds_mtr

Same as convert_dds.
In addition material files (*mtr) will be generated.


convert_png

Converts all files to png format.


convert_tga

Converts all files to tga format.



############
# Settings #
############

[OPTIONS]
USE_METALLICNESS=1

Reads metallicness textures (suffix "_m"), which NWN doesn't support and 
converts them to specular textures instead. 
Enabled by default. Set to 0 to disable.


[OPTIONS]
USE_GLOSSINESS=1

Reads glossiness textures (suffix "_g"), which NWN doesn't support and 
converts them to roughness textures instead (by inverting). 
Enabled by default. Set to 0 to disable.


[OPTIONS]
FILENAME_LIMIT=0

Cuts off filenames, if they exceed 16 characters. They will be cut in the 
middle to preserve suffixes. NOTE: May interfere with generating mtr files.
Disabled by default. Set to 1 to enable.


[OPTIONS]
AUTO_FLIP=1

Auto flips standard dds textures to match NWN requirements. This is not 
necessary for NWNs own dds format. 
Enabled by default. Set to 0 to enable.


[TEXTURE_TYPE]
SUFFIX_DELIMITER=_

Delimiter which seperated the suffix from the filename. Only a single character
is allowed, very limited regular expression support. 
Default delimiter is an underscore. 
NOTE: Only modify if you know what you're doing.
EXAMPLE: Set to "[0-9]" (without quotes) to use a single Number, this results 
         in "myfile123d.tga" being recognized as diffuse texture. This also 
         requires the MTR_REMOVE_DELIMITER option to be disabled.


[TEXTURE_TYPE]
MTR_REMOVE_DELIMITER=1

Determine whether the Delimtier should be kept when creating the mtr file. 
This is required in the above example.
Enabled by default. Set to 0 to keep the delimiter.
