Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Marscaleb

Editing the palette and stuff

Recommended Posts

I'm considering creating a new palette for my mod.
I was playing around in GIMP and I have something I think would be suitable to my purposes.

So the next step is to actually try to implement it so that I can see how it looks and works out.

I was looking around online, and the only tutorial I could find led me to install Slade and edit the palette through it. It is serviceable, but I wonder if there is a program that might be better. I ultimately have to select each color individually in Slade and in Gimp, and copy over the RGB values one at a time. Serviceable, but very time-consuming.
There is an option to import a palette from a file, but that won't do me much good because it would actually be more time-consuming to arrange the palette into the proper order within gimp. (I mean, the image I made has a logical order, but the actual palette numbers are really hard to rearrange because the colors are hard to distinguish.)

If there is a better program to use than Slade, I want to hear about it. I only grabbed this one because it was the first one I found that said it could do it. (Maybe something that could generate a palette according to a 16x16 image, and not the actual palette data? Just a thought.)

But the real problem I face next is arranging the way the colors fade out. That's the colormap, I think, but I don't understand how to edit it; both from just how to use the actual tools in Slade and because I don't understand the logic of how it works. I thought it was a straight set of linear groups and it goes from brightest to darkest. But apparently the distance from the camera and the angle are factors too? I don't even know the basic color theory I would want to apply to that.

Also, are there specific colors that HAVE to be special values? I thought that 0 HAD to be black, and 255 would be transparent. I might as well make sure of that. And speaking of black, is black supposed to be the universal darkest color of any range? I'm making an assumption there as well, and I should verify how it works.

And finally, I am going to need to import some art utilizing this new palette I have devised. I assume that I will be able to export the palette from Slade, import it into GIMP, save images using that palette, and then import them back into Slade without any real hassle. But if there is a better process to use, I'm all ears.

Share this post


Link to post
Marscaleb said:

I'm considering creating a new palette for my mod.
.....
If there is a better program to use than Slade, I want to hear about it.
.....


Better, I don't know, but it may help.

Many moons ago, bagheadspidey made some nifty apps, which he collected in what he called DOOMCRAP_1.4.
The app you want is called Palette Dump.

Run the batch file, load an image and press 'Dump Palette', give it a location and name and it saves the palette as an act file.
Load this act file into your map, then rename the lump to PLAYPAL, then test it playing the map.

http://baghead.drdteam.org/tools.xml

For creating the COLORMAPs, definitely use SLADE3.

Share this post


Link to post
Marscaleb said:

(Maybe something that could generate a palette according to a 16x16 image, and not the actual palette data? Just a thought.)

SLADE can do that actually. If you import a palette from a PNG, it will be from the pixel data, not from the PLTE chunk. In fact the PNG can perfectly well be truecolor and not have a PLTE chunk at all.

Marscaleb said:

Also, are there specific colors that HAVE to be special values? I thought that 0 HAD to be black, and 255 would be transparent. I might as well make sure of that. And speaking of black, is black supposed to be the universal darkest color of any range? I'm making an assumption there as well, and I should verify how it works.

0 doesn't have to be black, and 255 isn't transparent.

I'd recommend making 0 and 255 duplicates, and black. This will make it easier for some source ports such as ZDoom which need to get a duplicate color somewhere to turn one into a transparent color without reducing the color palette; but it's not strictly necessary.


As for the COLORMAP. Doom takes a pixel on the screen, calculate its brightness based on the local light level as well as the distance to the camera and some other considerations, and get a shift value Y between 0 and 31. Then it takes this pixel's color X, and look in the colormap to what color it translates to.

The colormap is fully arbitrary: Doom will use what it finds in it, regardless of what it is. You can have the colors fade to black, as they do normally; or to gray (aaaaah-ah, we fade to gray), or to white, or to blue... You can have a psychedelic acid trip with each color changing randomly to other colors without rhyme or reason, the engine won't complain. (The players might, though!)

The colormap generator in SLADE 3 is a simple tool that will automatically generate a colormap based on the same algorithm id used for Doom, which means that if you use the unchanged Doom palette, you'll get the exact same COLORMAP as the IWAD. For more advanced effects, you can edit the colormap in Gimp/Photoshop (it's a 256x34 bitmap) to have full control of how each color will shift, and then use SLADE 3 to convert that to raw/flat format, turning it into a valid COLORMAP lump.

Share this post


Link to post
Gez said:

SLADE can do that actually. If you import a palette from a PNG, it will be from the pixel data, not from the PLTE chunk. In fact the PNG can perfectly well be truecolor and not have a PLTE chunk at all.

Oh!
...
So it DOES! That will make tweaking the palette a LOT easier! Thank you much!
Also thank you for clarifying what those terms were.

Gez said:

0 doesn't have to be black, and 255 isn't transparent.


Um, then what IS transparent? How do I set that?
I have a habit of making that transparency color be something blatantly not matching the rest of the palette, but I guess that strictly isn't necessary with most modern tools.

Gez said:

You can have the colors fade to black, as they do normally; or to gray (aaaaah-ah, we fade to gray), or to white, or to blue...

This much I already understand; it's simple really. All you would have to do is change the palette so that the colors get more grey instead of getting darker, and then you have a fog effect. I remember Shadow Warrior doing this a few times.

Gez said:

As for the COLORMAP. Doom takes a pixel on the screen, calculate its brightness based on the local light level as well as the distance to the camera and some other considerations, and get a shift value Y between 0 and 31. Then it takes this pixel's color X, and look in the colormap to what color it translates to.

THIS is what I don't understand. But I've been re-reading this and staring at the colormap and I think I *may* have it.

First of all, I think I have been misinterpreting what was meant by how it calculates the brightness of the sector and the distance. I already knew that everything gets darker the further it is from you, but I was thinking that meant it calculated the color using those as two separate metrics in finding the color. Rather it is just using both of those to find out how much it is darkening the color, and that darkness is still just a single value. (Apparently a value of 0-32.)

So that colormap image is just a lookup table. The X value corresponds to the given color value of a texel, and the Y value is the darkness value already calculated.
And the advantage of using this complex lookup table instead of a simple mathematical algorithm is that you can curve the darkness to look more natural instead of a linear pattern. Plus some colors can shift to other hues if desired.
...So I'm guessing those thin lines of grey are used for the invincibility powerup, since they go backward.
Hm, I guess that means I could make invincibility have a different color to it, or potentially create new power-up effects that re-color the screen in like manner.
So what is that final row at the bottom that is all black?

Okay, so this just leaves the question of how to use the tools within Slade. I suppose I could just paint an image in Gimp and import it, but there are these tools that I ought to be able to use to at least give me a head start. But I don't know what I am doing.

My natural guess was that I would be selecting ranges of colors so that the program knows what colors constitute a "group" or a "gradient," but when I select "Origin" and "target" colors I still see a jumbled mess of colors in the preview, and the "resulting palette" just loses colors.

The color gradiant options make even less sense to me.

Share this post


Link to post
Marscaleb said:

Um, then what IS transparent? How do I set that?

The way the Doom engine works, textures and sprites are described as columns made of posts with a start offset and a length. A same column can have several posts, and the posts don't need to touch each other. That means that there can be gaps between vertical series of pixels.

To make it simpler: transparent pixels are simply pixels that are missing from the picture, and all 256 colors of the palette will be displayed, at least in vanilla. (ZDoom, as I said before, actually needs a transparent palette color and will seek a duplicate for that, preferring a duplicate of index 0.)

Feel free to use a palette with index 255 set to some contrasting color like cyan or magenta if that's easier for you to work with until you import the sprites and textures and convert them to Doom's native format. After that step is done, though, change the palette index 255 to make it a duplicate of palette index 0 and everyone will be happy.

Marscaleb said:

So that colormap image is just a lookup table.

Yep.

The first 32 lines are for light levels, then there's the invulnerability ramp, and finally an unused ramp. (It was originally meant for the light amplification visor, but then they decided to use ramp 0. That the colormap is still 256x34 instead of 256x33 is literally a bug in their editing tool, as they forgot to reduce the lump's total size when they changed it to generate one ramp less.)

Marscaleb said:

My natural guess was that I would be selecting ranges of colors so that the program knows what colors constitute a "group" or a "gradient," but when I select "Origin" and "target" colors I still see a jumbled mess of colors in the preview, and the "resulting palette" just loses colors.

https://i.imgur.com/SpPOQ4h.png
The color gradiant options make even less sense to me.


The color remap tool is meant to do stuff like recoloring sprites and textures; I'd be quite surprised if you can use it to successfully tweak a COLORMAP...

Share this post


Link to post

If you have a valid palette (PLAYPAL) and you want to generate a matching COLORMAP, right-click the palette in SLADE3 and choose "Generate COLORMAP". Also choose "Generate palettes -> Doom", which is needed to generate special palettes for occasions when the player takes damage, picks up items or wears a radsuit.

Share this post


Link to post

Oh, so if I want a new colormap to go with my new palette, then I HAVE to import it as a texture.

...so, I was thinking. If all the darkness and fading effects are done this way, then why don't we have any source ports try to interpolate new values from the colormap? I mean, if you revised the code so that, say, the darkness value was a float, and then you linearly interpolate the values of the colormap to a new truecolor value? Or maybe extend that darkness value to 256, and create a truecolor colormap that was 256x256 (or 256x257, I suppose) so that you could have more smoothed gradients for the shadows.
Has anyone done this? I imagine it would look a lot better than these flat renders that many of these source ports use.

...Then again, I guess it would be even easier to just take the original texel value and interpolate it to a given color, presumably black, as a straight mathematical process.

Share this post


Link to post
Marscaleb said:

Oh, so if I want a new colormap to go with my new palette, then I HAVE to import it as a texture.

You don't HAVE to - I've just told you the alternative method in my post above.

Share this post


Link to post
scifista42 said:

You don't HAVE to - I've just told you the alternative method in my post above.


Yeah sorry, I see that. I came back to this tab and was all like "Oh snap I never actually submitted my reply!" And then afterward saw your response.
Thank you, though.

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
×