The NNS TGA file format is a way of storing DS texture data inside a file that can be viewed by typical CG software. This makes it easier to see beforehand how certain texture compression parameters will affect the texture quality or apply particular conversion options to them.

NNS TGA files are usable by the NNS Blender Plugin, as well as the NNS export plugins for 3DS Max, Maya, and SoftImage. They can be produced by NitroPaint, OPTPiX iMageSutdio, and Photoshop with the export plugin.

To a typical decoder, an NNS TGA appears as a standard TGA image file. The only difference is that the ID string contains an identifier NNS_Tga Ver 1.0 (null-terminated) followed by a 32-bit offset to NNS texture data.

NNS Texture Data#

The NNS texture data appears at the end of the file and is pointed to by the ID string. This data takes the form of a series of blocks. Each block starts with an 8-byte string identifying the kind of block, followed by a 32-bit block length (including the block type and length fields). The types of blocks are outlined as follows:

BlockDescription
nns_c0xp A block with no data that indicates that the texture reserves color 0 for transparency. This only applies for texture formats palette4, palette16, and palette256.
nns_ctbl Export by Photoshop. Contains the color palette for the texture as 24-bit RGB.
nns_cidx Export by Photoshop. Contains color index data for the texture as 8-bits-per-pixel, compressed row-wise with RLE. Each segment begins with a lead byte, where the most significant bit set indicates a repeated byte. The low 7 bits are the length of that segment, minus one.
nns_endb A block with no data that marks the end of the NNS texture data.
nns_frmt Identifies the texture format used. This can be one of a3i5, palette4, palette16, palette256, a5i3, tex4x4, or direct. This is not null-terminated. This block should always appear first.
nns_gnam The texture's generator name (not null-terminated). Not used by converters.
nns_gray Export by Photoshop. This can be emitted instead of nns_ctbl and nns_cidx for a grayscale palette.
nns_gver The generator version string (not null-terminated). Not used by converters.
nns_imst Data particular to OPTPiX iMageStudio. Not relevant to any other software. Data is only output for palette4, palette16, palette256, a3i5 and a5i3 textures. Its data takes on the form of a sequence of blocks. Each block begins with an 8-character block identifier followed by a 32-bit block length that includes the identifier and block length fields.
* imstctbl specifies the color palette as a sequence of 24-bit RGB values in R, G, B byte order.
* imstatbl specifies the alpha channel of palette colors. iMageStudio handles a3i5 and a5i3 textures by duplicating the palette colors and varying the alpha channel.
* imstcidx specifies the indexed image data as an 8-bit-per-pixel bitmap and compressed with RLE. Each segment starts with a header byte where the highest bit is set for a run of one byte and clear for a nonrepeating sequence of bytes. The low 7 bits are the length of the segment minus one.
* imstplnm 16-bit, specifies the size of the color palette For a3i5 and a5i3 textures, this is the size of the palette without duplication.
nns_pcol The texture palette colors. Can be omitted for textures that do not use a palette.
nns_pidx The palette index data for a tex4x4 texture. Can be omitted for all other texture formats.
nns_pnam The name of the texture palette as an ASCII string (not null-terminated). This string can be 16 characters at maximum. This only needs to be present in a texture file that contains a color palette.
nns_pshp Data particular to Photoshop. Not relevant to other software.
nns_pver Photohop export plugin version. Only 1.0 is used. Required to appear before other Photoshop data blocks.
nns_t44o Export by Photoshop for tex4x4 textures, 5 bytes in data size. First byte is 0 if compressed without interpolation, or 1 if using interpolation. Bytes 2-3 are the compression thresholds for the red, green, and blue channels from 0-31. The last byte is set to 0 if the 4x4 compression filter was not used, and 1 if it was.
nns_txel The texel data for this texture.
nns_xpid Export by Photoshop. Contains 1 byte. Index of transparent color in Photoshop's palette.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 03-May-2024 14:01 by Garhoogin