Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
printz

What are the palette fade amounts?

Recommended Posts

What I'm asking is this: by how much amount are the blood images reddened, pickup images made olive, and colormaps darkened, each step? It would help to have a software that makes correct custom color fades.

Share this post


Link to post

There may be some consistent progression in the colour values in the pain and pickup palettes, as far as I know, but the colormap's levels definitely don't have any consistent progression in colour value. Perhaps it was meant to darken by the same amount at every stage, but due to the limitations of the palette, most of the colours completely lose their colour and become grey at different, seemingly arbitrary points. Any automated process meant to recreate this sort of pattern will probably be a bit off.

Share this post


Link to post

Creaphis said:
seemingly arbitrary points.

Try dimming the lights. Color is lost when light is dim. Now I have a foot lamp on and can barely tell the walls are cream colored and not white or something. During the day it's clear. Some brighter colors tend to get "dull" faster, but they are less saturated, apparently because they drop more in luminosity and that is a way to sustain the relative saturation level, otherwise colors will contrast against each other.

Any automated process meant to recreate this sort of pattern will probably be a bit off.

But not much: Inkworks produces a palette that's pretty similar if you don't colorize it.

Share this post


Link to post

Does the ZDoom source have the solution to this question? In what file?

Share this post


Link to post

This is something that has worried me with my colormap and palette effect transitions for my palette editor. I think, probably the best solution is to write a tool to extract the differences in color shades in sets of tables and apply those to a base palette for the fade effects. It might be off depending on how much the palette is changed, but I think it should work for the most part.
Generating a colormap darkening effect is much harder than the fade effects on the palette, since you have to choose the best color available in the palette. Still, there are algorithms that can calculate the closest colors with relatively good results.

This is one of those things I want to really be accurate with my palette editor. Which reminds me, heh, I need to start working more on that.

Share this post


Link to post

Man, I have not posted here for ages. Just recently got back into Doom. Anyway, since I am an artist more than anything else I been looking at how Doom handles the palette a bit.

Some areas are REALLY unoptimised because they were handled by an automated algorithm and not a good pair of human eyes.

I tried doing ramps from some of the doom colours to black (24 bit) and then let Cosmigo Promotion (pixel software I use) remap them to the Doom palette. The outcome was almost identical to what it already looks like.

http://ptoing.net/colormapcompare.png

This is a comparison image between the original colormap and one I modified by hand. It was just a quick test and of course would have to be checked in game. Tho I have no fast means to convert an image to colormap.lmp and back. A friend of mine is just attempting to fudge a little converter together which should hopefully not be too hard since the colormap.lmp is nothing more than a hextable with values corresponding to the indexes of the used main palette.

Will post any findings as I go along.

Share this post


Link to post

Sorry to bump this thread, but I didn't catch the last reply until now. Ptoing: at first you really had me excited, until I saw you modified it by hand, although I have to say, it's quite an impressive improvement. Would you mind if you uploaded your modified colormap? I'd love to be able to include that with the program. :)

Anyways, I've been progressing nicely on my program, but I'm getting to the point where I'm not quite sure if I'll be able to pull off the automated colormap generation that I wanted. The palette fade effects are actually quite simple to do, but when it comes to the colormap, I'm not working with colors themselves, but trying to find the best matches of colors that already exist.

Can anyone explain a good way of going about this? Is there some sort of algorithm available that I can study? I've searched the internet for a good while now, and it doesn't seem like there are a lot of resources available to this kind of thing. I'm going to try and look at XWE's source code to see what it does, but I've never messed around with the colormap building tool, so I'm not even sure about the quality of it's results...

Any help would really be appreciated! :o

Share this post


Link to post

Normally, what I'm thinking of is tinting the source color as you want, then finding the one in the palette with its three components closest to the target one. What math to use here -- I don't know. Probably the sum of squares.

Share this post


Link to post
printz said:

Normally, what I'm thinking of is tinting the source color as you want, then finding the one in the palette with its three components closest to the target one. What math to use here -- I don't know. Probably the sum of squares.


From ZDoom, written by Randy Heit:

/****************************/
/* Palette management stuff */
/****************************/

extern "C" BYTE BestColor_MMX (DWORD rgb, const DWORD *pal);

int BestColor (const uint32 *pal_in, int r, int g, int b, int first, int num)
{
#ifdef X86_ASM
	if (CPU.bMMX)
	{
		int pre = 256 - num - first;
		return BestColor_MMX (((first+pre)<<24)|(r<<16)|(g<<8)|b, pal_in-pre) - pre;
	}
#endif
	const PalEntry *pal = (const PalEntry *)pal_in;
	int bestcolor = first;
	int bestdist = 257*257+257*257+257*257;

	for (int color = first; color < num; color++)
	{
		int x = r - pal[color].r;
		int y = g - pal[color].g;
		int z = b - pal[color].b;
		int dist = x*x + y*y + z*z;
		if (dist < bestdist)
		{
			if (dist == 0)
				return color;

			bestdist = dist;
			bestcolor = color;
		}
	}
	return bestcolor;
}

Share this post


Link to post

Thanks, I've been studying that code snippet for half the night. I think I'm finally understanding it. However, there are a few things I'm unsure of..

For starters, what are the function's arguments supposed to be? I'm assuming "R", "G", and "B" are the color components of the index in the palette that I'm wanting to match close to, but what are the "first" and "num" arguments?

Share this post


Link to post
EarthQuake said:

Thanks, I've been studying that code snippet for half the night. I think I'm finally understanding it. However, there are a few things I'm unsure of..

For starters, what are the function's arguments supposed to be? I'm assuming "R", "G", and "B" are the color components of the index in the palette that I'm wanting to match close to, but what are the "first" and "num" arguments?

It's to restrict the search to a certain range of the palette. To search the whole palette, 0 and 256 are passed; to search only the second group of 16 colors, you could use 16 and 32, for example.

Share this post


Link to post

Ah, neat. :)
I had a feeling that's what they were for. This should work nicely for my needs, although I haven't been able to test it just yet. I've been working on a way to weigh the results a bit depending on the hue, so it looks a bit more natural. It's hard to explain, but it's similar to the adjustments done when grayscaling colors, where one hue is perceived as brighter than another.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×