Sign in to follow this  
Followers 0

Transparency index in in loaded/saved graphics

Is it possible to change the index read as "transparent"?

As far as I know it's hardcoded per game, and in DOOM it's 247 while in some other games it's 251.

If it's not possible currently, I'd like to request it for the next version or beta. Perhaps it could be specified per game, but all I really care about is DOOM, so a single value that overrides the defaults would suit me fine.

If, for example, I were to set the transparency index to 255, it would treat color 255 in a loaded graphic as the transparent area, or it would give the transparent area of a saved graphic index 255 (instead of 247).

Also, it would be convient (in combination with the above) if you could define what color the transparency index uses. In DOOM this color is to be used instead of cyan for any graphics saved to the hard drive. Perhaps to remind the user, this color would also be used within XWE itself to surround graphics, instead of cyan (though if it's always cyan it's okay).

Share this post


Link to post

This is false. Doom uses all of the colors in its palette, transparency is handled differently. See this and this. In Doom's graphic formats, transparent pixels are simply not described.

Share this post


Link to post

I know that, but when a graphic is converted to a BMP or GIF to be saved to disk for editing, the program (XWE in this case) has to use one of the 256 colors Doom can use to represent the protions of the Doom graphic where nothing is drawn. All the programs I know take color 247 (black in Doom, being the last of the dark blues range) and uses it for the exported graphic's surrounding color, painting it cyan, magenta, dark green, or whatever. I don't know about DeepSea (I don't use it), but winTex, DeuTex and XWE don't let you change that 247 to something else, as far as I know.

Share this post


Link to post

The one you don't use (DeePsea) does allow you to change the colour and palette index.

By default, DeePsea uses index 251 which is magenta. It does not change this to any other colour but just uses the normal colour from the palette. Whilst this means an extracted graphic has a "correct" palette, it does mean that if you try to import/export a graphic that uses magenta, it will be treated as marked for transparency. However, this has caused me minimal problems over the years of using it.

I don't *think* any of the original Doom graphics use index 251. However, in the other games DeePsea uses a similar system and the colour/index used does appear in standard graphics (Strife seems to be particularly bad). However, with the options being customisable, it's less of a problem than it could be.

Share this post


Link to post

Enjay said:
I don't *think* any of the original Doom graphics use index 251.

That seems to be correct. Jack Vermeulen scanned all the graphics and found out only colors 251 and 255 is unused in the two DOOMs.

I plan to use 255 as the background, as I plan to edit a good deal of DOOM based graphics, and I think I'll likely use 251 at some point in my custom graphics since it's part of the magenta range. Color 255 is an unrelated color that (as far as I know) Doom uses only to draw the dots in the fps meter when in devparm mode.

My guess is that the id guys used 255 as the background for graphics when editing them in other programs.

Share this post


Link to post

Why do you need index 247 to be available though? Index 0 is black (0, 0, 0) just like 247. That's why most tools use it. Unless you are altering the palette, you aren't losing anything by taking away 247 because index 0 has the same colour.

Share this post


Link to post

Enjay said:
Why do you need index 247 to be available though?

Some graphics from the games using the blue range use it, and I'll be extracting resources and modifying them, so I don't want to have to color those in manually. And aside from my case, which could be labeled as nitpicky because there should be few such resources, I think being able to use 255 (or 251) for the background is convenient for working with IWAD resources, in general.

EDIT: Look at POSSD4D6 in XWE. One would think someone shot a bullet through its butt.

Share this post


Link to post
myk said:

EDIT: Look at POSSD4D6 in XWE. One would think someone shot a bullet through its butt.


Heh, yeah I see what you mean. :) Recolouring all the sprites manually would be a pain if quite a few were affected by this.

However, what XWE should really be doing (IMO) is, if it is using index 247 as cyan, it should remap any pixels that use 247 to index 0 when exporting. Perhaps that should be the feature request? Of course, the option should be togglable to allow cases of special/custom palettes.

Share this post


Link to post

Enjay said:
Perhaps that should be the feature request? Of course, the option should be togglable to allow cases of special/custom palettes.

Maybe that could be added, but personally I'd rather just have a cuztomizable index and a customizable color (aside from the existing defaults). All around, it's better, as indeed it would be useful for any game or any TC.

The XWE INI file could have an entry for the index (0-255), and another for the color (RGB, 0-255 each).

Share this post


Link to post
Enjay said:

However, what XWE should really be doing (IMO) is, if it is using index 247 as cyan, it should remap any pixels that use 247 to index 0 when exporting. Perhaps that should be the feature request?


Or it could export to indexed PNG with an alpha map. It would allow full 256 colors + transparent pixels (just like Doom graphics) and solve this issue at least for people working with PNG.

PNG is Teh Awsum™.

Share this post


Link to post

ATM it is creating holes in graphics that shouldn't have holes so it should be addressed IMO.

I like both my and myk's suggestions simply because, even now, there are still quite a few tools that don't handle PNG transparency very well but plenty (all?) relevant tools will handle BMPs.

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  
Followers 0