Is there a good reason for index 247 to be what it is? Any reason that includes the letters X, W, and E in that order is not a good reason.
If it were swapped with index 255, it'd make a nice, beautiful range from 240 to 254. Here that smooth range is murdered by index 247.
(Also, ZDoom would be happier if there was a duplicate color somewhere.)
Palette question
Moderators: Xaser, Dr_Nostromo
- NeuralStunner
- Posts: 253
- Joined: Tue Dec 29, 2009 3:46
- Location: IN SPACE
- Contact:
Re: Palette question
The IWad is assembled by ye olde DeuTex*, which expects that particular color at that particular place.
When it's me, color 0 or 255 is reserved for transparancy, though ZDoom never hears of it. The mod itself gets a palette where that color's black.
* If there's a better utility for this, we haven't heard of one. If Slade3 could handle DeuTex scripts it would be a joy indeed.
When it's me, color 0 or 255 is reserved for transparancy, though ZDoom never hears of it. The mod itself gets a palette where that color's black.
* If there's a better utility for this, we haven't heard of one. If Slade3 could handle DeuTex scripts it would be a joy indeed.
Dean Koontz wrote:Human beings can always be relied upon to exert, with vigor, their God-given right to be stupid.
Spoiler: System Specs
- Cage
- Posts: 75
- Joined: Sat Dec 24, 2011 11:04
Re: Palette question
The range is smooth, but it's just interrupted. That's because of Deutex, but having a unique colour for transparency is a lot more convenient than using black - I'd have to triple check everything if there's no "poke-holes" I'm used to a separate transparent colour, and it seems there's no problems with it, at least in ZDoom.
- Gez
- Developer
- Posts: 1399
- Joined: Mon Oct 22, 2007 16:47
Re: Palette question
I've thought about it.NeuralStunner wrote:* If there's a better utility for this, we haven't heard of one. If Slade3 could handle DeuTex scripts it would be a joy indeed.
ZDoom automatically sacrifices one of the palette colors to make it transparent. It does so by looking for any duplicate color.Cage wrote:The range is smooth, but it's just interrupted. That's because of Deutex, but having a unique colour for transparency is a lot more convenient than using black - I'd have to triple check everything if there's no "poke-holes" I'm used to a separate transparent colour, and it seems there's no problems with it, at least in ZDoom.
Code: Select all
// In ZDoom's new texture system, color 0 is used as the transparent color.
// But color 0 is also a valid color for Doom engine graphics. What to do?
// Simple. The default palette for every game has at least one duplicate
// color, so find a duplicate pair of palette entries, make one of them a
// duplicate of color 0, and remap every graphic so that it uses that entry
// instead of entry 0.
void FPalette::MakeGoodRemap ()
{
PalEntry color0 = BaseColors[0];
int i;
// First try for an exact match of color 0. Only Hexen does not have one.
for (i = 1; i < 256; ++i)
{
if (BaseColors[i] == color0)
{
Remap[0] = i;
break;
}
}
// If there is no duplicate of color 0, find the first set of duplicate
// colors and make one of them a duplicate of color 0. In Hexen's PLAYPAL
// colors 209 and 229 are the only duplicates, but we cannot assume
// anything because the player might be using a custom PLAYPAL where those
// entries are not duplicates.
if (Remap[0] == 0)
{
PalEntry sortcopy[256];
for (i = 0; i < 256; ++i)
{
sortcopy[i] = BaseColors[i] | (i << 24);
}
qsort (sortcopy, 256, 4, sortforremap);
for (i = 255; i > 0; --i)
{
if ((sortcopy[i] & 0xFFFFFF) == (sortcopy[i-1] & 0xFFFFFF))
{
int new0 = sortcopy[i].a;
int dup = sortcopy[i-1].a;
if (new0 > dup)
{
// Make the lower-numbered entry a copy of color 0. (Just because.)
swapvalues (new0, dup);
}
Remap[0] = new0;
Remap[new0] = dup;
BaseColors[new0] = color0;
break;
}
}
}
// If there were no duplicates, InitPalette() will remap color 0 to the
// closest matching color. Hopefully nobody will use a palette where all
// 256 entries are different. :-)
}
- Cage
- Posts: 75
- Joined: Sat Dec 24, 2011 11:04
Re: Palette question
So during the development we can use the current one, for convenience, and for the release IWAD we should use a PLAYPAL which will have the index 247 as a duplicate of an other colour?
- Gez
- Developer
- Posts: 1399
- Joined: Mon Oct 22, 2007 16:47
Re: Palette question
I'd even advise for the release to swap out 247 to last place, shifting 248-255 to be 247-254; and to use SLADE's color remap feature on all graphics (248:255=247:254).
Are you running DeuTex on Windows or Linux? I might provide a hacked version of it that uses index 255 for transparency instead of index 247. I really dislike seeing this beautiful range murdered by DeuTex's pigheadedness.
Are you running DeuTex on Windows or Linux? I might provide a hacked version of it that uses index 255 for transparency instead of index 247. I really dislike seeing this beautiful range murdered by DeuTex's pigheadedness.
- Xaser
- Developer
- Posts: 112
- Joined: Sat Jul 16, 2005 2:51
Re: Palette question
Yeah, that index was changed to deal with certain editors making silly assumptions about index 247. I also have to ask the flipside question: Is there any good reason to change it at this point? All that would effectively do is force us to convert a bunch of graphics for something that's less-than-cosmetic as it makes no in-game difference at all.
Also, what does ZDoom do if there are no duplicate colors in a palette? That seems like an odd expectation and something I'd rather see a "transparentindex" variable in GAMEINFO for.
Also, what does ZDoom do if there are no duplicate colors in a palette? That seems like an odd expectation and something I'd rather see a "transparentindex" variable in GAMEINFO for.
-
- Developer
- Posts: 491
- Joined: Sun Jan 24, 2010 22:21
Re: Palette question
It finds the color closest to index 0 and pretends it's a duplicate. ZDoom always uses 0 as transparent (since it's faster this way), but does remapping so this is a non-issue. While it is optimal to have it a contrasting color during development, I would recommend switching it to a duplicate when finished. Heck you can make things easy and make 247 a duplicate of 246 or 248.Xaser wrote:Also, what does ZDoom do if there are no duplicate colors in a palette? That seems like an odd expectation and something I'd rather see a "transparentindex" variable in GAMEINFO for.
- Cage
- Posts: 75
- Joined: Sat Dec 24, 2011 11:04
Re: Palette question
I'd say no - if this doesnt matter from a technical standpoint, and doesnt effect ease/amount of work on GFX (at least in my case, but I'm the guy who's doing the most in this field at least at the moment!) then why bother?Xaser wrote:Is there any good reason to change it at this point? All that would effectively do is force us to convert a bunch of graphics for something that's less-than-cosmetic as it makes no in-game difference at all.