Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "Quake palette"

From Quake Wiki

m (Download: use lowercase for extensions to stay with the program)
(dwemolu xzonljf)
Line 1: Line 1:
[[Image:Qpalette.png|right|thumb|The Quake palette.]]
+
lpwgzrvblfxjlj, [url=http://www.hbrexvqxsh.com/]awdxtmhqrg[/url]
Color 255 is transparent for sprites, 2d lmps, and gfx.wad entries (excluding [[conchars]], in which case it is black (color 0) that's made transparent). It is important that palette index 0 is black. The parameters for the [[color]] console command are the row #, but is restricted to rows 0 - 13.
 
 
 
It is important that the latter 8 palette rows are "backwards" (light-to-dark instead of dark-to-light). It appears that the [[id Software|ID]] artists did this for no good reason in the original Quake palette, and the engine programmers were forced to add a hack to accommodate it (along with the comment "the artists made some backwards ranges. sigh"). The only area this affects is player shirt/pants color translation (where one palette row must be mapped to another).
 
 
 
 
 
{|style="color:white;font-weight:bold;font-size:8pt;text-align:center;" cellspacing="0" cellpadding="2"
 
|-
 
|style="color:black;text-align:right;"|White (0)
 
|style="background:#000000;height:8pt;"|0
 
|style="background:#0f0f0f;height:8pt;"|1
 
|style="background:#1f1f1f;height:8pt;"|2
 
|style="background:#2f2f2f;height:8pt;"|3
 
|style="background:#3f3f3f;height:8pt;"|4
 
|style="background:#4b4b4b;height:8pt;"|5
 
|style="background:#5b5b5b;height:8pt;"|6
 
|style="background:#6b6b6b;height:8pt;"|7
 
|style="background:#7b7b7b;height:8pt;"|8
 
|style="background:#8b8b8b;height:8pt;"|9
 
|style="background:#9b9b9b;height:8pt;"|10
 
|style="background:#ababab;height:8pt;"|11
 
|style="background:#bbbbbb;height:8pt;"|12
 
|style="background:#cbcbcb;height:8pt;"|13
 
|style="background:#dbdbdb;height:8pt;"|14
 
|style="background:#ebebeb;height:8pt;color:black;"|15
 
|-
 
|style="color:black;text-align:right;"|Brown (1)
 
|style="background:#0f0b07;height:8pt;"|16
 
|style="background:#170f0b;height:8pt;"|17
 
|style="background:#1f170b;height:8pt;"|18
 
|style="background:#271b0f;height:8pt;"|19
 
|style="background:#2f2313;height:8pt;"|20
 
|style="background:#372b17;height:8pt;"|21
 
|style="background:#3f2f17;height:8pt;"|22
 
|style="background:#4b371b;height:8pt;"|23
 
|style="background:#533b1b;height:8pt;"|24
 
|style="background:#5b431f;height:8pt;"|25
 
|style="background:#634b1f;height:8pt;"|26
 
|style="background:#6b531f;height:8pt;"|27
 
|style="background:#73571f;height:8pt;"|28
 
|style="background:#7b5f23;height:8pt;"|29
 
|style="background:#836723;height:8pt;"|30
 
|style="background:#8f6f23;height:8pt;"|31
 
|-
 
|style="color:black;text-align:right;"|Light blue (2)
 
|style="background:#0b0b0f;height:8pt;"|32
 
|style="background:#13131b;height:8pt;"|33
 
|style="background:#1b1b27;height:8pt;"|34
 
|style="background:#272733;height:8pt;"|35
 
|style="background:#2f2f3f;height:8pt;"|36
 
|style="background:#37374b;height:8pt;"|37
 
|style="background:#3f3f57;height:8pt;"|38
 
|style="background:#474767;height:8pt;"|39
 
|style="background:#4f4f73;height:8pt;"|40
 
|style="background:#5b5b7f;height:8pt;"|41
 
|style="background:#63638b;height:8pt;"|42
 
|style="background:#6b6b97;height:8pt;"|43
 
|style="background:#7373a3;height:8pt;"|44
 
|style="background:#7b7baf;height:8pt;"|45
 
|style="background:#8383bb;height:8pt;"|46
 
|style="background:#8b8bcb;height:8pt;"|47
 
|-
 
|style="color:black;text-align:right;"|Green (3)
 
|style="background:#000000;height:8pt;"|48
 
|style="background:#070700;height:8pt;"|49
 
|style="background:#0b0b00;height:8pt;"|50
 
|style="background:#131300;height:8pt;"|51
 
|style="background:#1b1b00;height:8pt;"|52
 
|style="background:#232300;height:8pt;"|53
 
|style="background:#2b2b07;height:8pt;"|54
 
|style="background:#2f2f07;height:8pt;"|55
 
|style="background:#373707;height:8pt;"|56
 
|style="background:#3f3f07;height:8pt;"|57
 
|style="background:#474707;height:8pt;"|58
 
|style="background:#4b4b0b;height:8pt;"|59
 
|style="background:#53530b;height:8pt;"|60
 
|style="background:#5b5b0b;height:8pt;"|61
 
|style="background:#63630b;height:8pt;"|62
 
|style="background:#6b6b0f;height:8pt;"|63
 
|-
 
|style="color:black;text-align:right;"|Red (4)
 
|style="background:#070000;height:8pt;"|64
 
|style="background:#0f0000;height:8pt;"|65
 
|style="background:#170000;height:8pt;"|66
 
|style="background:#1f0000;height:8pt;"|67
 
|style="background:#270000;height:8pt;"|68
 
|style="background:#2f0000;height:8pt;"|69
 
|style="background:#370000;height:8pt;"|70
 
|style="background:#3f0000;height:8pt;"|71
 
|style="background:#470000;height:8pt;"|72
 
|style="background:#4f0000;height:8pt;"|73
 
|style="background:#570000;height:8pt;"|74
 
|style="background:#5f0000;height:8pt;"|75
 
|style="background:#670000;height:8pt;"|76
 
|style="background:#6f0000;height:8pt;"|77
 
|style="background:#770000;height:8pt;"|78
 
|style="background:#7f0000;height:8pt;"|79
 
|-
 
|style="color:black;text-align:right;"|Orange (5)
 
|style="background:#131300;height:8pt;"|80
 
|style="background:#1b1b00;height:8pt;"|81
 
|style="background:#232300;height:8pt;"|82
 
|style="background:#2f2b00;height:8pt;"|83
 
|style="background:#372f00;height:8pt;"|84
 
|style="background:#433700;height:8pt;"|85
 
|style="background:#4b3b07;height:8pt;"|86
 
|style="background:#574307;height:8pt;"|87
 
|style="background:#5f4707;height:8pt;"|88
 
|style="background:#6b4b0b;height:8pt;"|89
 
|style="background:#77530f;height:8pt;"|90
 
|style="background:#835713;height:8pt;"|91
 
|style="background:#8b5b13;height:8pt;"|92
 
|style="background:#975f1b;height:8pt;"|93
 
|style="background:#a3631f;height:8pt;"|94
 
|style="background:#af6723;height:8pt;"|95
 
|-
 
|style="color:black;text-align:right;"|Gold (6)
 
|style="background:#231307;height:8pt;"|96
 
|style="background:#2f170b;height:8pt;"|97
 
|style="background:#3b1f0f;height:8pt;"|98
 
|style="background:#4b2313;height:8pt;"|99
 
|style="background:#572b17;height:8pt;"|100
 
|style="background:#632f1f;height:8pt;"|101
 
|style="background:#733723;height:8pt;"|102
 
|style="background:#7f3b2b;height:8pt;"|103
 
|style="background:#8f4333;height:8pt;"|104
 
|style="background:#9f4f33;height:8pt;"|105
 
|style="background:#af632f;height:8pt;"|106
 
|style="background:#bf772f;height:8pt;"|107
 
|style="background:#cf8f2b;height:8pt;"|108
 
|style="background:#dfab27;height:8pt;"|109
 
|style="background:#efcb1f;height:8pt;"|110
 
|style="background:#fff31b;height:8pt;color:black;"|111
 
|-
 
|style="color:black;text-align:right;"|Peach (7)
 
|style="background:#0b0700;height:8pt;"|112
 
|style="background:#1b1300;height:8pt;"|113
 
|style="background:#2b230f;height:8pt;"|114
 
|style="background:#372b13;height:8pt;"|115
 
|style="background:#47331b;height:8pt;"|116
 
|style="background:#533723;height:8pt;"|117
 
|style="background:#633f2b;height:8pt;"|118
 
|style="background:#6f4733;height:8pt;"|119
 
|style="background:#7f533f;height:8pt;"|120
 
|style="background:#8b5f47;height:8pt;"|121
 
|style="background:#9b6b53;height:8pt;"|122
 
|style="background:#a77b5f;height:8pt;"|123
 
|style="background:#b7876b;height:8pt;"|124
 
|style="background:#c3937b;height:8pt;"|125
 
|style="background:#d3a38b;height:8pt;"|126
 
|style="background:#e3b397;height:8pt;"|127
 
|-
 
|style="color:black;text-align:right;"|Purple (8)
 
|style="background:#ab8ba3;height:8pt;"|128
 
|style="background:#9f7f97;height:8pt;"|129
 
|style="background:#937387;height:8pt;"|130
 
|style="background:#8b677b;height:8pt;"|131
 
|style="background:#7f5b6f;height:8pt;"|132
 
|style="background:#775363;height:8pt;"|133
 
|style="background:#6b4b57;height:8pt;"|134
 
|style="background:#5f3f4b;height:8pt;"|135
 
|style="background:#573743;height:8pt;"|136
 
|style="background:#4b2f37;height:8pt;"|137
 
|style="background:#43272f;height:8pt;"|138
 
|style="background:#371f23;height:8pt;"|139
 
|style="background:#2b171b;height:8pt;"|140
 
|style="background:#231313;height:8pt;"|141
 
|style="background:#170b0b;height:8pt;"|142
 
|style="background:#0f0707;height:8pt;"|143
 
|-
 
|style="color:black;text-align:right;"|Magenta (9)
 
|style="background:#bb739f;height:8pt;"|144
 
|style="background:#af6b8f;height:8pt;"|145
 
|style="background:#a35f83;height:8pt;"|146
 
|style="background:#975777;height:8pt;"|147
 
|style="background:#8b4f6b;height:8pt;"|148
 
|style="background:#7f4b5f;height:8pt;"|149
 
|style="background:#734353;height:8pt;"|150
 
|style="background:#6b3b4b;height:8pt;"|151
 
|style="background:#5f333f;height:8pt;"|152
 
|style="background:#532b37;height:8pt;"|153
 
|style="background:#47232b;height:8pt;"|154
 
|style="background:#3b1f23;height:8pt;"|155
 
|style="background:#2f171b;height:8pt;"|156
 
|style="background:#231313;height:8pt;"|157
 
|style="background:#170b0b;height:8pt;"|158
 
|style="background:#0f0707;height:8pt;"|159
 
|-
 
|style="color:black;text-align:right;"|Tan (10)
 
|style="background:#dbc3bb;height:8pt;"|160
 
|style="background:#cbb3a7;height:8pt;"|161
 
|style="background:#bfa39b;height:8pt;"|162
 
|style="background:#af978b;height:8pt;"|163
 
|style="background:#a3877b;height:8pt;"|164
 
|style="background:#977b6f;height:8pt;"|165
 
|style="background:#876f5f;height:8pt;"|166
 
|style="background:#7b6353;height:8pt;"|167
 
|style="background:#6b5747;height:8pt;"|168
 
|style="background:#5f4b3b;height:8pt;"|169
 
|style="background:#533f33;height:8pt;"|170
 
|style="background:#433327;height:8pt;"|171
 
|style="background:#372b1f;height:8pt;"|172
 
|style="background:#271f17;height:8pt;"|173
 
|style="background:#1b130f;height:8pt;"|174
 
|style="background:#0f0b07;height:8pt;"|175
 
|-
 
|style="color:black;text-align:right;"|Light green (11)
 
|style="background:#6f837b;height:8pt;"|176
 
|style="background:#677b6f;height:8pt;"|177
 
|style="background:#5f7367;height:8pt;"|178
 
|style="background:#576b5f;height:8pt;"|179
 
|style="background:#4f6357;height:8pt;"|180
 
|style="background:#475b4f;height:8pt;"|181
 
|style="background:#3f5347;height:8pt;"|182
 
|style="background:#374b3f;height:8pt;"|183
 
|style="background:#2f4337;height:8pt;"|184
 
|style="background:#2b3b2f;height:8pt;"|185
 
|style="background:#233327;height:8pt;"|186
 
|style="background:#1f2b1f;height:8pt;"|187
 
|style="background:#172317;height:8pt;"|188
 
|style="background:#0f1b13;height:8pt;"|189
 
|style="background:#0b130b;height:8pt;"|190
 
|style="background:#070b07;height:8pt;"|191
 
|-
 
|style="color:black;text-align:right;"|Yellow (12)
 
|style="background:#fff31b;height:8pt;color:black;"|192
 
|style="background:#efdf17;height:8pt;color:black;"|193
 
|style="background:#dbcb13;height:8pt;"|194
 
|style="background:#cbb70f;height:8pt;"|195
 
|style="background:#bba70f;height:8pt;"|196
 
|style="background:#ab970b;height:8pt;"|197
 
|style="background:#9b8307;height:8pt;"|198
 
|style="background:#8b7307;height:8pt;"|199
 
|style="background:#7b6307;height:8pt;"|200
 
|style="background:#6b5300;height:8pt;"|201
 
|style="background:#5b4700;height:8pt;"|202
 
|style="background:#4b3700;height:8pt;"|203
 
|style="background:#3b2b00;height:8pt;"|204
 
|style="background:#2b1f00;height:8pt;"|205
 
|style="background:#1b0f00;height:8pt;"|206
 
|style="background:#0b0700;height:8pt;"|207
 
|-
 
|style="color:black;text-align:right;"|Blue (13)
 
|style="background:#0000ff;height:8pt;"|208
 
|style="background:#0b0bef;height:8pt;"|209
 
|style="background:#1313df;height:8pt;"|210
 
|style="background:#1b1bcf;height:8pt;"|211
 
|style="background:#2323bf;height:8pt;"|212
 
|style="background:#2b2baf;height:8pt;"|213
 
|style="background:#2f2f9f;height:8pt;"|214
 
|style="background:#2f2f8f;height:8pt;"|215
 
|style="background:#2f2f7f;height:8pt;"|216
 
|style="background:#2f2f6f;height:8pt;"|217
 
|style="background:#2f2f5f;height:8pt;"|218
 
|style="background:#2b2b4f;height:8pt;"|219
 
|style="background:#23233f;height:8pt;"|220
 
|style="background:#1b1b2f;height:8pt;"|221
 
|style="background:#13131f;height:8pt;"|222
 
|style="background:#0b0b0f;height:8pt;"|223
 
|-
 
|style="color:black;text-align:right;"|Fire (14)
 
|style="background:#2b0000;height:8pt;"|224
 
|style="background:#3b0000;height:8pt;"|225
 
|style="background:#4b0700;height:8pt;"|226
 
|style="background:#5f0700;height:8pt;"|227
 
|style="background:#6f0f00;height:8pt;"|228
 
|style="background:#7f1707;height:8pt;"|229
 
|style="background:#931f07;height:8pt;"|230
 
|style="background:#a3270b;height:8pt;"|231
 
|style="background:#b7330f;height:8pt;"|232
 
|style="background:#c34b1b;height:8pt;"|233
 
|style="background:#cf632b;height:8pt;"|234
 
|style="background:#db7f3b;height:8pt;"|235
 
|style="background:#e3974f;height:8pt;"|236
 
|style="background:#e7ab5f;height:8pt;"|237
 
|style="background:#efbf77;height:8pt;"|238
 
|style="background:#f7d38b;height:8pt;color:black;"|239
 
|-
 
|style="color:black;text-align:right;"|Brights (15)
 
|style="background:#a77b3b;height:8pt;"|240
 
|style="background:#b79b37;height:8pt;"|241
 
|style="background:#c7c337;height:8pt;"|242
 
|style="background:#e7e357;height:8pt;color:black;"|243
 
|style="background:#7fbfff;height:8pt;color:black;"|244
 
|style="background:#abe7ff;height:8pt;color:black;"|245
 
|style="background:#d7ffff;height:8pt;color:black;"|246
 
|style="background:#670000;height:8pt;"|247
 
|style="background:#8b0000;height:8pt;"|248
 
|style="background:#b30000;height:8pt;"|249
 
|style="background:#d70000;height:8pt;"|250
 
|style="background:#ff0000;height:8pt;"|251
 
|style="background:#fff393;height:8pt;color:black;"|252
 
|style="background:#fff7c7;height:8pt;color:black;"|253
 
|style="background:#ffffff;height:8pt;color:black;"|254
 
|style="background:#9f5b53;height:8pt;"|255
 
|-
 
|}
 
 
 
 
 
 
 
=== palette.lmp ===
 
The palette is stored in gfx/palette.lmp. It consists of 256 RGB values using one byte per component, coming out to 768 bytes in total.
 
 
 
=== Download ===
 
* [[Image:quake_palette.zip]] - The Quake palette in following formats: .aco, .act, .ase, .pal and the original palette.lmp (raw lump of RGB values, 768-bit). Also has a plaintext hex matrix and a .png preview.
 
 
 
== Colormap ==
 
[[Image:Colormap.png|right|thumb|The Quake colormap.]]
 
 
 
The colormap is a table used for lighting in software Quake engines. It contains a column of 64 values for each palette color. Each value is an index into the palette representing as closely as possible the original color brightened or darkened: shade 0 is double bright, shade 32 is the original color, and shade 63 is black.
 
 
 
"Fullbright" colors are those which are not lit in the colormap, simply using the original color for all 64 shades. These colors, when used in textures and model skins, will not be affected by lighting. Fullbrights are used for things like fire and glowing lights. In Quake these are the last 32 colors in the palette.
 
 
 
Since the [[GLQuake]] engine ignores the colormap, it doesn't support fullbrights. Most user-modified engines have fixed this problem, being hard-coded to treat the last 32 colors as fullbright. For this reason, you shouldn't generate a colormap with a different amount of fullbrights, since it will work in software engines but not in modern GL engines.
 
 
 
=== colormap.lmp ===
 
The colormap is stored in gfx/colormap.lmp. The version included with Quake is 16385 bytes. Since the colormap only requires 16384 bytes (256 * 64), I'm not exactly sure what the extra byte (<tt>0x20</tt>) at the end is for.
 
 
 
=== Generating the colormap ===
 
The following C code will generate a colormap.lmp that is nearly (but not exactly) identical to the Quake colormap. Written by [[metlslime]] who placed it in the public domain.
 
 
 
/* sample a 24-bit RGB value to one of the colours on the existing 8-bit palette */
 
unsigned char convert_24_to_8(const unsigned char palette[768], const int rgb[3])
 
{
 
  int i, j;
 
  int best_index = -1;
 
  int best_dist = 0;
 
 
  for (i = 0; i < 256; i++)
 
  {
 
    int dist = 0;
 
 
    for (j = 0; j < 3; j++)
 
    {
 
    /* note that we could use RGB luminosity bias for greater accuracy, but quake's colormap apparently didn't do this */
 
      int d = abs(rgb[j] - palette[i*3+j]);
 
      dist += d * d;
 
    }
 
 
    if (best_index == -1 || dist < best_dist)
 
    {
 
      best_index = i;
 
      best_dist = dist;
 
    }
 
  }
 
 
  return (unsigned char)best_index;
 
}
 
 
void generate_colormap(const unsigned char palette[768], unsigned char out_colormap[16384])
 
{
 
  int num_fullbrights = 32; /* the last 32 colours will be full bright */
 
  int x, y, i;
 
 
  for (x = 0; x < 256; x++)
 
  {
 
    for (y = 0; y < 64; y++)
 
    {
 
      if (x < 256 - num_fullbrights)
 
      {
 
        int rgb[3];
 
 
        for (i = 0; i < 3; i++)
 
        {
 
          rgb[i] = (palette[x*3+i] * (63 - y) + 16) >> 5; /* divide by 32, rounding to nearest integer */
 
          if (rgb[i] > 255)
 
            rgb[i] = 255;
 
        }
 
 
        out_colormap[y*256+x] = convert_24_to_8(palette, rgb);
 
      }
 
      else
 
      {
 
      /* this colour is a fullbright, just keep the original colour */
 
        out_colormap[y*256+x] = x;
 
      }
 
    }
 
  }
 
}
 
 
 
== Legal status ==
 
John Carmack officially put palette.lmp in the public domain{{citation needed}} to make Quake ports easier, so it is legal to, for example, embed it right into an engine executable. Colormap.lmp can also be considered public domain as it is trivially derived from the palette.
 
 
 
== Related Info ==
 
* Most engine mods use 32-bit colour, so you need not worry about palettes. With 32-bit textures, shirt/pants colour changing and fullbrights are only possible if engines support a new implementation of them, for example [[DarkPlaces]]'s [[DP_GFX_EXTERNALTEXTURES]] extension, which allows additional _glow, _pants, _shirt, etc textures on top of the main one)
 

Revision as of 12:58, 21 December 2013

lpwgzrvblfxjlj, [url=http://www.hbrexvqxsh.com/]awdxtmhqrg[/url]