advice for editing graphics for an amateur

DoomWorld forum user Mr.UnSmiley asks:

     ", as someone with access to an old version of
     Photoshop (CS2) and very little knowledge of pixel
     art, I am wondering, is there an easy way to 
     convert a Doom 64 sprite into the color palette of
     a specific Doom monster, rather than whatever 
     Slade chooses from the entire Doom palette?"

As an unofficial member of the DoomWorld forum band of luddites, I'm going to tackle this question in the best way I can. The first thing I'm going to say is that I have close to zero experience with using Adobe Photoshop in all its incarnations. Though I'm slightly more experienced with The GIMP, I do absolutely no Doom editing with either of these programs! Nope, I'm sitting here with a Linux computer running an ancient Windows paint program running through WINE. I'll cite the exact program I use in just a moment but first I want to say that you don't have to use the program I use. It's more important that you learn the concepts and processes of what I'm about to lay down. The implementation is left to the user and his/her preferences. What is important is that whatever tools are chosen, they are capable of performing these few tasks along with the user's ability to utilize all of the gray matter above one's neck.

Okay, so now for the record, my ancient Windows paint application I'll be using in my examples is NeoPaint 4.7c.

Oh, the joy of using paletted video modes in game programs! Doom, as you may know, is also an ancient program. It hails from a day when nobody in their right mind would ever program an action video game in Windows. Why? Because Windows is/was slow as molasses in January! Video games in that day for the PC were written for DOS. There's a really good video I recently watched which explains how games were written to take full advantage of 32-bit PC hardware without Windows being in the way:

Doom itself uses a 256-color video mode which lends itself to a neat little video trick called palette manipulation. Doom's palette is actually many 256-color pages. When the player is hit by a shotgun guy's shell or gets his face gnawed on by a demon, the screen's colors turn to redder versions of this Doom palette to confer to the player, "Hey! You're taking damage, you could DIE if you allow this to continue!" For the purposes of answering the original question, we're going to ignore this part and just focus on the fact of Doom using 256-color video mode.

Doom's 256-color palette is a very well thought out solution to the problems the original authors of the game were faced with. The stock Doom palette looks like this:

If we want to design custom assets for use with Doom, we recognize this palette as fact and paint those assets accordingly. Now, Mr.UnSmiley wants to use some sprite graphics from Doom64, a Nintendo64 port of the game Doom, he's acquired from somewhere. I do not have the assets he speaks of. So, I went Google image searching for something to use. I ended up finding two monster's-worth of sprites on a website called The Spriters Resource. From there, I simply downloaded the single pictures encompassing all of the frames of those two monsters.

Of course, those pictures are PNG images with MILLIONS of colors. What we need to do is reduce the quantity of colors used down to that Doom palette I mentioned above. Actually, that's not the only thing we need to do with our newly acquired asset. Do you know what the other thing is we need to do? That's right, we need each cell of our animation to be a separate graphic! That's a bunch of copy and pasting to new image we're going to do. If we had those individual cells as graphic files already, we would be applying our color reduction strategies to each individual cell graphic file. It's a tedious, boring task which I've performed countless times. For the purposes of our conceptual conversation here, having a single file to work with will simplify our learning process.

I've now opened one of these two files in my trusty NeoPaint for Windows graphic paint program. In the menu, I've chosen "Picture", -> "Convert to" -> "256-color (8-bit)".

The paint program responds with this dialog:

The astute reader here should notice something in the middle of this dialog box. Under the heading "Conversion palette:", there are four options:

  • Optimized
  • Internet / Web
  • Standard Windows
  • Custom

And Custom is the option I've selected. But what file am I pointing to? I know it says some-path-to-name...skunkwrx.pal, but what does that mean? For me, it's the custom palette I've been working with lately. I have it. You don't. But you don't want it. What you want is the standard stock Doom palette. I have one of those saved on my computer too. I could place a link here on my website for you to download it but I'm not going to.

"What?! You bastard!"

Bear with me... I'm making an important point here. If I were to make that link to my stock Doom palette available here on this website, which I could easily do, it would tie you to using the same paint program I use. The fact of the matter is that different paint programs use different palette formats! This is a very important consideration to keep in mind. For instance, I have several files in my Doom directories on my computer which end with the extension ".pal". But they're not all created with the same program. One of them in particular is the actual .pal entry used in Doom. Several are .pal files for my paint program, NeoPaint for Windows and still others are .pal files generated by another program I use in Doom graphic editing called GrafX2. Each of these different .pal extension'd files are specific to the program they were created in and you will generate an error trying to open one in a program that is not the program it was created in/for.

Now you've read my little cautionary tale. You should have a method of actually tracking which .pal files you have were created with which program. This could be as simple as writing down on a specific piece of paper a little map of your files or it could be some kind of naming convention you use in your files, such as;
mypalette1_NPW.pal, anotherpalette_GFX2.pal,
where you've encoded the generating program's name into the palette's filename. Whatever you do must make sense to exactly one person... YOU. This is one of those points that comes back to my earlier comment about gray matter on top of necks.

Well, great. "How do I get a .pal file that works with Doom graphics?"
Start with a Doom graphic! You can get a Doom graphic in multiple ways. You could download one of any of a number of texture packs available on the Internet. Or you could export a single texture, flat, or sprite cell from a Doom IWAD file using SLADE, then open that graphic with whichever paint program you choose and find in its menu something along the lines of "save palette". In my case, with NeoPaint, it's "Picture" -> "Edit palette" which opens up a dialog box with another menu where I select "File" -> "Save palette". Coincidentally, this same dialog box also has the ability to Load palette. What a useful feature!

Now would be an excellent time to take a break from reading my prolific prose and actually find yourself a paint program to use, get to know its menus and features and assure yourself that it has the ability to work with 256-color palettes in the way I've described so far. I can't imagine any good paint program not having a feature to cut, copy and paste but you should also ensure you know how to do that in your program of choice because that's what we're going to do next!

Because we started with one big picture that contains many cells of animation, we need to slice it up into individual graphics to import into our wad file using SLADE. I noticed that the graphic file for the Pain Elemental downloaded from the Spriter's Resource website mentioned above has a very dark background. The first thing I did with this graphic was I chose the color fill tool from the menu in NeoPaint and selected Doom's palette number 251 as my fill color. It's an obnoxiously bright shade of pink. It just so happens that its RGB values in 8-bits are 255, 0, 255. Yeah, no green at all and red and blue cranked up as high as they go. On the graphic, I pointed at a place as between cells as possible and clicked.

With the background this horrible bright pink, it's now much easier to select the rectangular area surrounding the animation cell I wish to "Copy to..." the new file I'm creating to later be imported into my wad file using SLADE.

Now, to this point, I've been working mostly with a single sheet which contains all of the cells of our Pain Elementalist monster in one file. I could load that one file and adjust its palette entries however I see fit and all of the cells would reflect my color change choices at once. I would then slice and dice the individual cells from this big sheet and save them as I just described. But Mr.UnSmiley also mentioned this in his post: there an easy way to convert a Doom 64
     sprite into the color palette of a specific 
     Doom monster, rather than whatever Slade 
     chooses from the entire Doom palette? like,
     a way to restrict photoshop's palette to 
     those very specific colors, and then force 
     photoshop to use that palette on another 

So, to me it sounds like Mr.UnSmiley already has his cells isolated into their own little cubicle files. That allows me the opportunity to show why I searched out for, found and use the GrafX2 program I mentioned earlier. Remember too that I spoke about .pal files generated by it. What GrafX2 has for a feature is the ability to edit the individual colors of the palette, save the new palette, save the modified resulting animation cell and then apply that same palette to the next opened cell of animation. This is handy-dandy for recoloring the stock Doom sprites to one's liking. I likey the demons...

When editing the palette to recolor my monster sprites, I'm conscious to use color values already in the Doom palette. This is important! If I don't adhere to the already existing colors of Doom, I would then need to load a custom palette in the wad file. It would faithfully reproduce those colors for my custom sprites but would have unintended consequences for other remaining unaltered Doom sprites, flats and textures. So basically, when doing a recolor of my sprites, I'm duplicating a color ramp from one place in the palette to replace a color ramp in another place in the same palette.

At this point in time, I could simply import my new sprite graphics into the Doom wad file using SLADE and the colors of the pixels in the image would transfer correctly to the proper shades used in Doom. But what if I wanted to make further changes to the same image? Like, say I wanted the reds of the original to be in the hue of greens and vice versa. I'd already clobbered the reds and now have two sets of green color ramps.

This is where I use a little practice I like to call palette normalization. I open my now-recolored sprite image in NeoPaint. The picture looks just as awesome as I had saved in using GrafX2. But if you look at the 256-color palette associated with the image on the left portion of NeoPaint's interface, it looks like this. As you can see, I have some greens and yellows repeated in different places and the palette generally looks rather wonky when compared to the stock Doom palette I pictured above in this page. What I need is for the image to have a palette which contains all of the colors I have available in the Doom palette. Please ignore the purple and teal hues of my custom palette here and just imagine that they're the blue color ramp you'd normally see in the stock Doom palette. Everything else is stock Doom anyhow but we no longer have colors repeated in multiple places in the palette.

To get to this place I need to go, in NeoPaint, I select Picture -> Edit palette... which opens up the Palette Editor function of NeoPaint. From here, I choose File ->Load palette... and that brings up a file browser where I select my saved custom palette and click OK. NeoPaint responds with a dialog box asking me to choose between three different options for how I want this palette to be applied to my image. I choose the option "Match to Nearest Solid Color".

At this point, I have a palette normalized image which contains all of the colors in my chosen palette available to be molested again had I wanted to make a separate color ramp adjustment. Or, I can just go import my recolored sprite graphic into my wad file using SLADE now.

If I were dealing with transparent png images, I could just use them immediately in SLADE. However, earlier on, I'd taken Mr.UnSmiley's pain elemental graphic and given it a hot pink background to contrast it with its generally dark colors for me to be able to slice the individual graphics from the big stock sheet of all of the cells that make up this monster's animation. So, there's going to be an additional step here which my dear reader may or may not need to take, depending on whether or not he/she are dealing with a mask color.

Generally, all the images which make up a monster sprite's animations are named similiarly. It's not required but it sure makes dealing with the code one uses in DECORATE or ZScript easier to write. For instance, the chaingun guy sprites in Doom all begin with these four letters; CPOS. The graphics would be named, say, CPOSA1, CPOSA2A8, CPOSA3A7, CPOSA4A6, CPOSA5, CPOSB1, CPOSB2B8, and so on. Graphics with eight characters are used for two different drawing positions, so CPOSA4A6 is the equivalent to having the same graphic used for both CPOSA4 and CPOSA6. The A6 position is a mirror image of what one sees in the A4 position. Obviously, if a graphic's name is only six characters long, it is only used in one position.

For demonstration purposes, I'm going to deal with only a single graphic here in our SLADE tutorial. Using one's computer's file explorer, he/she only needs to drag the graphic from a file explorer window to the proper position in the SLADE program's interface.

Notice that next to our sample graphic, it says "Graphic (PNG)" but next to all of our pre-existing graphics it says "Graphic (Doom)". We right-click our graphic's name in that list and select Graphic -> Convert to... which brings up a dialog box.

In our game, we don't want monsters with big hot pink boxes drawn around them. It kindof takes away from that illusion of reality a little bit. We notice in this dialog box that Enable Transparency is already checked for us. All we need to do is select the proper color from our imported image which will represent transparency.

So we click the radio button which says Transparent Colour and then click the color box to the right, currently cyan, to bring up a color picker.

Note the red, green and blue values on the top right of this color picker dialog. Cyan is zero red, 255 for green and 255 for blue. We change this to read 255 for red, zero for green and leave the blue at 255 and then we click the Select button.

Once we've done this, we see the hot pink has magically disappeared from our image. We can click the Convert button now.

Great! Are we done yet? Not quite. Doom sprites need to be drawn with offsets. What this means is our monster graphic needs to be centered horizontally and then needs to be aligned vertically to not look like it's either flying when it's not nor swimming in the dirt. SLADE provides a magic button for this. Its default is for the type Monster, which we'll use here but know there is a drop-down box to select Projectile instead if you happen to be dealing with rocket sprites or something of that nature where our graphic would be centered both horizontally and vertically.

Our wonderful Doom64 pain elemental graphic now has offsets of 47 pixels in the X direction and 87 pixels in the Y direction. Click anywhere else in the list of assets on the left pain of the window and SLADE will ask whether we want to save our work, which, we would like to be saved.

There you have it; all explained and demonstrated. This is how one gets their own custom assets imported into a Doom wad file. Now all you have to do is repeat this process for however many assets you want imported into your custom wad file!

Robotron INDUSTRIES, (c)2024 Copyright Chap Software,
All Rights Reserved