Actions

Difference between revisions of "Palette"

From Sonic Retro

(Gameboy Advance Palette)
m
Line 1: Line 1:
 
A '''palette''' is selection of colours which is used in an image. Rather than defining a colour for each individual [[pixel]] (such as in 24-bit colour images), palettes are used to link pixels to colour data by way of an index reference. Graphics in [[Sega Genesis|Mega Drive]], [[Master System]], [[Game Gear]] and [[GameBoy Advance]] games all use palettes.
 
A '''palette''' is selection of colours which is used in an image. Rather than defining a colour for each individual [[pixel]] (such as in 24-bit colour images), palettes are used to link pixels to colour data by way of an index reference. Graphics in [[Sega Genesis|Mega Drive]], [[Master System]], [[Game Gear]] and [[GameBoy Advance]] games all use palettes.
  
According to the Oxford English Dictionary, "palette" didn't appear until the 19th century. "Pallet" is the original, correct spelling. However, both are correct today, and "palette" is more commonly used.
+
According to the Oxford English Dictionary, "palette" didn't appear until the 19th century, and the more usual spelling was "pallet"; however, "palette" is the more usual modern spelling. ("Pallet" originally referred generally to any large flat wooden surface, such as the ones artists would use to mix paints. The modern meaning of this word is restricted to the wooden surfaces used to carry large amounts of material by forklift trucks.)
  
==Mega Drive Palette==
+
==Mega Drive Colour Gamut==
The Mega Drive VDP supports four palettes of 16 colors each, with each color being selected from a total of 512 colors; using the Shadow/Highlight capabilities of the VDP, the total raises to 1536. Each palette is 32 bytes, with each color occupying two bytes. These two bytes are in the format '''0B GR''', where B = blue; G = green; and R = red. The B, G and R can be any of the following values:[[Image:Mega Drive Palette.png|right]]
+
The Mega Drive VDP supports four palettes of 16 colors each, with each color being selected from a 512-color gamut; using the Shadow/Highlight capabilities of the VDP, the total raises to 1536. Each palette is 32 bytes, with each color occupying two bytes. These two bytes are in the format '''0B GR''', where B = blue; G = green; and R = red. The B, G and R can be any of the following values:[[Image:Mega Drive Palette.png|right]]
 
*0 (0000)
 
*0 (0000)
 
*2 (0010)
 
*2 (0010)

Revision as of 11:35, 15 March 2010

A palette is selection of colours which is used in an image. Rather than defining a colour for each individual pixel (such as in 24-bit colour images), palettes are used to link pixels to colour data by way of an index reference. Graphics in Mega Drive, Master System, Game Gear and GameBoy Advance games all use palettes.

According to the Oxford English Dictionary, "palette" didn't appear until the 19th century, and the more usual spelling was "pallet"; however, "palette" is the more usual modern spelling. ("Pallet" originally referred generally to any large flat wooden surface, such as the ones artists would use to mix paints. The modern meaning of this word is restricted to the wooden surfaces used to carry large amounts of material by forklift trucks.)

Mega Drive Colour Gamut

The Mega Drive VDP supports four palettes of 16 colors each, with each color being selected from a 512-color gamut; using the Shadow/Highlight capabilities of the VDP, the total raises to 1536. Each palette is 32 bytes, with each color occupying two bytes. These two bytes are in the format 0B GR, where B = blue; G = green; and R = red. The B, G and R can be any of the following values:
  • 0 (0000)
  • 2 (0010)
  • 4 (0100)
  • 6 (0110)
  • 8 (1000)
  • A (1010)
  • C (1100)
  • E (1110)

To obtain equivalent values out of 256, the procedure is as follows:

- when in normal mode, use the values above in each nybble (e.g. 2 -> 0010 0010 -> $22 -> 34)
- when in shadow mode, divide the values above by two, and use them in each nybble (e.g. 2 -> 0001 0001 -> $11 -> 17)
- when in highlight mode, divide the values above by two, add 0111, and use them in each nybble (e.g. 2 -> 1000 1000 -> $88 -> 136)

The MD tile format stores two pixels in each byte. For example, if a tile byte is 0x4F, then the first pixel is color 4, and the second pixel is color 15. Note that color 0 in each palette is usually transparent, though color 0 of palette 0 is typically used for the border color.

Master System Palette

Consists of 16 colours, each represented by eight bits (a single byte) in the format 00BBGGRR, where BB = blue; GG = green; and RR = red. The BB, GG and RR can be any of the following values:
  • 00 = 0
  • 01 = 85
  • 10 = 170
  • 11 = 255

As such, the highest palette value is 00111111, which is 3F when converted to a byte.

Game Gear Palette

Consists of 16 colours, each represented by two bytes (four nybbles) in the format GR 0B, where G = green; R = red and B = blue. The G, R and B can be any of the following values:
  • 0/1 = 0
  • 2/3 = 36
  • 4/5 = 72
  • 6/7 = 109
  • 8/9 = 145
  • A/B = 182
  • C/D = 218
  • E/F = 255

32X/Gameboy Advance Palette

With 256 color indices for a framebuffer, the 32X uses the BGR555 format (15 bit colors). With 256 colour indices for 4 backgrounds and 256 colour indices for sprites, the Gameboy Advance also uses the BGR555 format, except that the GBA takes the color value byteswapped.. One colour index contains two bytes (5 bits per component): 0BBBBBGGGGGRRRRR. The Gameboy Advance also has support for RGB mode where one pixel on the screen is represented by the RGB value and not by an index, so you can use images with up to 32768 colours.