Re: Doom2 pics with Quake palette

Denis (d.moeller@rendsburg.netsurf.de)
Mon, 10 Jun 1996 23:21:14 +0200

Date: Mon, 10 Jun 1996 23:21:14 +0200
Message-Id: <199606102121.XAA04313@rendsburg.netsurf.de>
To: quake-dev@gamers.org
From: Denis <d.moeller@rendsburg.netsurf.de>
Subject: Re: Doom2 pics with Quake palette

Hi!

At 11:35 10.06.1996 +0200, you wrote:
>The match I made with a 2*delta_Red + 3*delta_Green + 1*delta_Blue
>gave less than 30 exact matches, and about the same with a perceived
>distance >= 20.0. Prospects did not look to good.
30 matches? Hmm?

>Does anybody know what kind of palette matching algorithm DMVIEW
>actually uses?
Err, no, but I used to add a FitPalette function to NWTpro some
months ago. This is to fit two different palettes, no dithering
or something, just finding the closest match...
(I made this off my mind, so don't expect anything)

PalA[768] has the original palette and PalB[768] has the 'to'
palette - both in RGB-form (values don't exceed 64 for 256 colors).

---
char DPal[256];

for (dmax=3000,i=0;i<256;i++) { for (k=0;k<256;k++) {

h1=(PalA[i*3]-PalB[k*3]); h2=(PalA[i*3+1]-PalB[k*3+1]); h3=(PalA[i*3+2]-PalB[k*3+2]);

d=sqrt(h1*h1+h2*h2+h3*h3);

if (d<dmax) { dmax=d; color=k; } } DPal[i]=color; }

---

After this, replace color 'c' (0-255) with DPal[c]

Hope this helps...

>P.S.: the remark by John Carmack in Info (5) seemed to indicate that >Adrian Carmack and Kevin Cloud did not like the results of a similar >conversion. I wonder what kind of matching they tried, and when. What I (we) always most hated about the Doom palette was its incredible lack of dark red colors...

cya Denis

---
Denis Moeller, author of NWTpro v1.4 and TiC's WAD Reviews. 
e-mail: d.moeller@rendsburg.netsurf.de, #irc: panza
http://www.geocities.com/Hollywood/2299/