Ok, so since I’ve been playing around with the Freedoom assets, I wanted to process all the assets and then make them into an iwad.Â And for the graphics this meant generating a simple color cube palette and then transforming all of the images to match that palette.Â And the results were, while recognizable as DooM, they are drab.
And yes, it’s gray, and drab.Â So UK.Â And there is another problem, many of the ‘graphics’ assets were a mix of PNG and GIF, and it turns out that in the GIF format you usually have a single color set as your transparent color, and it’ll get cut out automatically.Â In this case the transparent color is cyan.Â However there is some cyan still in the image!
So the best way I figured to ‘fix’ this was to do a straight conversion using Imagemagick.Â So I loaded up paintbrush of all things and noticed that for some reason the colors had bled on the gif’s I had from the Freedoom pack I’d downloaded.Â And that there were actually 3 cyan colors that needed to be purged.Â In this case in hex they are 0x00fefe, 0x00f2f2, 0x02f6f5, and the one that they should have been, 0x00ffffff
convert ..\graphics_freedoom\old\wia20200.gif -transparent #02f6f5 -transparent #00fefe -transparent #00f2f2 -transparent #00ffff oldpng\wia20200.png
So I had to run convert like this against all the GIFs that I needed to fill in the graphics that I’m currently not processing in Python.Â Now the images actually look right, no surprise cyan, but my palette still sucks
Although the Freedoom team has told me that it’s far easier to just use the DooM palette as their assets use that palette and it’ll just work.Â But I’m too stupid for that.Â One great feature ofÂ Imagemagick is that you can hand it an image, and ask it to reduce it to any arbitrary number of colors, and it’ll do a great job of it.Â And while that is great for a single image, that doesn’t help me when I’m talking about thousands of images.Â ExceptÂ Imagemagick also has another great ability which is to paste a new image to the right of an existing one.Â So with a little creative use of the make command I can then build a single giant image that contains all of the artwork.Â Isn’t that great?
Although great care and detail went into the original DooM palette selection we can throw all of that away, and let a program stitch everything together, and then have it analyze the entire mess, and come up with the ‘ultimate palette’ that works best with everything.Â Although one word of warning it takes well over an hour on an i7 to just stitch the images together (I should have setup a RAM disk) but it only took about 10 minutes forÂ Imagemagick to process the blob image to come up with 255 colors that work best across the entire image set.
With the reduction done, the next thing to do is to create a ‘palette image’, which is one pixel for each color.Â This is the palette that we will use to ‘reduce’ all the images against.Â It’s more so to let Imagemagick do the hard work of selecting a palette.
convert slug256.png -unique-colors -scale 100% slug256_table.png
And the next thing is to extract the RGB set, which DooM uses for it’s palette.Â In this case each color is is represented by three bytes.
convert -size 256×1 -depth 8 slug256_table.png -append rgb:playpal-base256.lmp
And then the next step is to process this palette with dmutils dcolors.Â While it is primarily designed to use the LMB file format from Amiga fame, it wasn’t too hard to modify it to read a palette file directly, and let it add in the ‘red pain’ color shift, along with the green ‘bio hazard suit’ effect.Â The color map it generates is totally corrupt at the moment, so I’m using the old perl program to generate one based off of the palettes.
Indeed it is something so crazy that I really don’t want to even do it a second time to make sure my process was reproducible.Â However compared to before, I think the results speak for themselves:
So while it does take the better part of forever to go through all the images like this, it certainly gives zeeDoom a little more ‘building the world from scratch’ type feel.