RAW file format: Difference between revisions

From DF21 Wiki
(Created page with "'''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 [https://df-21.net/documentation/DFSPECS/s_palplt.htm#PAL%20Files palettes]. RAW textures will be loaded in place of a classic texture if they have the same name (eg. <code>hello.BM</code>, <code>hello.RAW</code>). They ''must'' be exactly double the dimensions of the [https://df-21.net/doc...")
 
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
RAW textures will be loaded in place of a classic texture if they have the same name (eg. <code>hello.BM</code>, <code>hello.RAW</code>). They ''must'' be exactly double the dimensions of the [https://df-21.net/documentation/DFSPECS/s_bm.htm BM] they are replacing. For example, a 64x128 BM must be replaced by a 128x256 RAW.
RAW textures will be loaded in place of a classic texture if they have the same name (eg. <code>hello.BM</code>, <code>hello.RAW</code>). They ''must'' be exactly double the dimensions of the [https://df-21.net/documentation/DFSPECS/s_bm.htm BM] they are replacing. For example, a 64x128 BM must be replaced by a 128x256 RAW.


=== File format ===
== File format ==
RAW files are headerless and uncompressed. Image width and height are obtained from the corresponding BM.
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 <code>BM width x BM height x 4</code>.
A RAW contains nothing more than an array of pixels. The number of pixels will be <code>BM width x BM height x 4</code>. Pixels are arranged by rows (note this is different from BMs where pixels are arranged in columns).


Each pixel is a 4 byte struct:
Each pixel is a 4 byte struct:


<pre>
<pre>
Pixel {
Pixel  
   Red
{
   Blue
   Red     byte
   Green
   Blue     byte
   Alpha
   Green   byte
   Alpha   byte
}
}
</pre>
</pre>
Each value can be between 0 and 0xFF.
The way the Alpha channel is handled by the game is as follows:
{| class="wikitable"
|-
| <code>0</code> || The pixel will be transparent on an adjoining-mid texture, otherwise it will be full-bright.
|-
| <code>Any value from 0x1 to 0xFE</code> || The pixel will be full-bright (fully lit in all light levels and produce bloom)
|-
| <code>0xFF</code> || 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.
[[Category: Remaster Specs]]

Latest revision as of 04:38, 12 March 2024

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      byte
   Blue     byte
   Green    byte
   Alpha    byte
}

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.