Skip to content

PAA Encoder

Matthew Barker edited this page Jun 14, 2026 · 1 revision

BIS.PAA.Encoder

DXT1/DXT5 PAA texture encoding with mipmap generation. Converts source images (PNG, BMP, etc.) into PAA format textures suitable for Arma 3.

Depends on: BIS.PAA, BCnEncoder.Net

Format Background

The PAA encoder takes standard image formats and produces PAA files with DXT1 or DXT5 compression, automatically generating a full mip chain. This is the reverse of the BIS.PAA module's decoding pipeline.

Key Types

Encoder namespace (BIS.PAA.Encoder)

Type Description
PaaEncoder Main encoding class — accepts images and produces PAA byte arrays
EncodingOptions Configuration for encoding (format, mipmap settings, quality)

Format namespace (BIS.PAA.Encoder.Format)

Type Description
DxtCompressionType DXT1 or DXT5
MipmapGeneration Controls mip chain generation (auto, none, custom)

Usage

// Encode a PNG file to PAA
var encoder = new PaaEncoder();
byte[] paaData = encoder.EncodeFromFile("input.png", DxtCompressionType.DXT5);
File.WriteAllBytes("output.paa", paaData);

// Encode from a stream
using var stream = File.OpenRead("input.png");
byte[] paaData2 = encoder.EncodeFromStream(stream, DxtCompressionType.DXT1);

// With custom options
var options = new EncodingOptions
{
    CompressionType = DxtCompressionType.DXT5,
    GenerateMipMaps = true,
    MaxMipMapSize = 512,
};
byte[] paaData3 = encoder.EncodeFromFile("input.png", options);

DXT vs Source Format

Source Format Recommended Target Notes
Photographs / diffuse maps DXT5 Better colour + alpha quality
Colour with 1-bit alpha DXT1 Smaller, sufficient for trails/mask
Normal maps DXT5 (with swizzle) Preserves normal vector precision
Interface / UI DXT1 or DXT5 Depends on alpha requirements

Test Data

No dedicated test data directory for encoding — the encoder tests in BIS.PAA.Encoder.Test generate their own test images programmatically and verify the round-trip through BIS.PAA decoding.

Clone this wiki locally