Duke Nukem 3D Palette Format

From ModdingWiki
Jump to: navigation, search
Duke Nukem 3D Palette Format
Format typePalette
HardwareVGA
Colour depth18-bit
Number of colours256
GamesNone

Duke Nukem 3D stores its palette information in the files PALETTE.DAT and LOOKUP.DAT. The game only uses 256 colours, but uses various lookup tables to give the appearance of varying levels and colours of light.

PALETTE.DAT contains the palette for the entire game along with shading and translucency lookups.

LOOKUP.DAT contains the lookup tables for the various virtual palettes used within the game other than palette 0.

PALETTE.DAT format

PALETTE.DAT is made up of 3 sections; Palette data, shade tables and a translucency table.

Data type Name Description
UINT8 [256][3] palette The game palette data stored as a standard 6-bit VGA palette.
INT16LE numpalookups The number of palette lookup tables in the file
UINT8 [numpalookups][256] palookup Array of simple lookup tables for each palette entry
UINT8 [256][256] transluc 2-dimensional array to find the blended result of two palette entries

Shade Tables

The shade tables are simple lookup tables that translate a given palette entry to its equivalent at a given level of darkness.

Translucency Table

The translucency table is a 2-dimensional array that gives a result when two palette entries are alpha-blended together.

LOOKUP.DAT format

LOOKUP.DAT is made up of 2 sections; Palette swap tables and alternate palettes. Alternate palettes are used for full-screen animations such as the title screen and episode cut-scenes

Data type Name Description
UINT8 spritepals The number of palette lookup tables in the file
PALETTE_SWAP [spritepals] palette_swaps Array of simple lookup tables for each palette entry
UINT8 [n][256][3] alt_palettes Animation palettes stored as a standard 6-bit VGA palette. These palettes take up the remainder of the file

Palette Swap format

Each PALETTE_SWAP is defined as the following 257-byte structure:

Data type Name Description
UINT8 palette_swap_index The index of this palette in the game
UINT8 [256] palette_swap_table Lookup table for this palette