RAW file format

From DF21 Wiki

RAW is an image format introduced with the Dark Forces Remaster. It is the format for high resolution textures. RAW textures are true colour; they do not reference the original palettes.

RAW textures will be loaded in place of a classic texture if they have the same name (eg. hello.BM, hello.RAW). They must be exactly double the dimensions of the BM they are replacing. For example, a 64x128 BM must be replaced by a 128x256 RAW.

File format

RAW files are headerless and uncompressed. Image width and height are obtained from the corresponding BM.

A RAW contains nothing more than an array of pixels. The number of pixels will be BM width x BM height x 4. Pixels are arranged by rows (note this is different from BMs where pixels are arranged in columns).

Each pixel is a 4 byte struct:

Pixel {
   Red
   Blue
   Green
   Alpha
}

Each value can be between 0 and 0xFF.

The way the Alpha channel is handled by the game is as follows:

0 The pixel will be transparent on an adjoining-mid texture, otherwise it will be full-bright.
Any value from 0x1 to 0xFE The pixel will be full-bright (fully lit in all light levels and produce bloom)
0xFF An ordinary pixel.

Multiple images

Where a RAW is replacing a multi BM (most commonly, a switch), each subsequent image simply follows immediately after the previous one.