Palettes

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
A '''palette''' is, at its simplest, a lookup-table of colors with their corresponding index that is utilized when displaying computer graphics. Palettes are often hardware defined (i.e. the palette used by the graphics hardware of the [[:Category:Nintendo_Entertainment_System|NES]]) or specific to the file-format or software (such as a palette embedded within a [[GIF]] or [[PNG|8-bit PNG]]). Whilst palettes are common across all media, they are particularly relevant in games.
+
A '''palette''' is, at its simplest, a lookup-table of colors with their corresponding index that is utilized when displaying computer graphics. Palettes are either
 +
 
 +
- Hardware defined (i.e. the palette used by the graphics hardware of the [[:Category:Nintendo_Entertainment_System|NES]]) or
 +
- Specific to the file-format or software (such as a palette embedded within a [[GIF]] or [[PNG|8-bit PNG]]).
 +
 
 +
Whilst palettes are common across all media, they are particularly useful in games,
  
 
= Game palettes =
 
= Game palettes =

Revision as of 12:36, 11 January 2023

A palette is, at its simplest, a lookup-table of colors with their corresponding index that is utilized when displaying computer graphics. Palettes are either

- Hardware defined (i.e. the palette used by the graphics hardware of the NES) or - Specific to the file-format or software (such as a palette embedded within a GIF or 8-bit PNG).

Whilst palettes are common across all media, they are particularly useful in games,

Game palettes

Early game formats would often make use of a palette for two primary reasons:

  • The historical limits of graphics hardware meant that a full-spectrum of colors was not feasible or necessary.
  • Palette's allow for greater compression of in-game assets and less processing-time when loading assets.

Structure

Game palettes often comprise a the following chunks of data:

  • The palette itself, usually containing 256 swatches and 768 bytes in length. The palette size of 256 swatches allows each index to be represented by a single byte and corresponds to 8bpp mode (or 256 color mode) limitations of personal computers of the time.
  • Any number of Blending tables, which store pre-computed transformations on a palette, such as shading or blending. The results refer back to an index in the palette itself.

The palette:

  • Palettes are often stored as tuples (1 byte for the red, green and blue channel in sequence) or in planes (1 byte for the red component for each swatch, then 1 byte for the green, then 1 byte for the blue).
  • Whilst RGB component ordering is conventional, the components are sometimes ordered differently.
  • If the palette appears dimmer than expected, it might be using less bits per byte in one or all components. It was common to store components using 6-bits (0-63). These would need to be multiplied by 4 to map the components back to the expected range of 0-255.
  • Often, the palette is the first chunk of data within the file.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox