Custom Palette Issue

Are you experiencing a problem? Maybe you can't get your scripts to do what you need, or are frustrated by a feature you just can't seem to get working? Let us know about it here and we will try our best to help you out!
User avatar
Marscaleb
Posts: 89
Joined: Sat Jun 25, 2016 12:57 pm
Location: California or Utah
Contact:

Custom Palette Issue

Post by Marscaleb »

So the custom wad I have been tinkering with uses a custom palette. I had ported over all of Doom 2's graphics to this new palette as a starting point. Whenever I had loaded this wad, however, I found that the title pic had noticeable errors in it where some colors turned to black.

Image
You can see a dark line through the edges of the "DOOM" letters, dark lines through the explosions in the background at the bottom and side of the image, etc.

I had shrugged this off as simply my missing some of the colors when I ported it over. But today I tinkered with the mod a bit to fix some other textures. When I did, I noticed that these color problems I was seeing in the title pic were not actually present; this is something 3DGE is doing with my custom palette.

I was able to confirm this by loading my wad in GXDoomGPL; it does not have any errors.

After poking around in Slade, I found that the problem color was index 247, which in the original Doom palette was the darkest shade of blue, which also happened to be pure black and an exact match for index 0. (Index 0 is pure black both in the original Doom palette and my custom palette.)

So something in 3DGE is f***ing up and ignoring the palette actually contained in the wad, and instead replacing index 247 with either a forced copy of palette index 0 or a forced pure black.

I was about to check if this problem is occurring in Heretic, since it uses a different palette, but that same palette index in Heretic is a very dark brown, so even if I did know a tile that uses it, I might not be able to tell if it is using the correct color or not.

User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

Re: Custom Palette Issue

Post by Corbachu »

Are you using a custom PLAYPAL lump? Or a colormap lump? Example wad? :)
\(סּںסּَ` )/ۜ

User avatar
Marscaleb
Posts: 89
Joined: Sat Jun 25, 2016 12:57 pm
Location: California or Utah
Contact:

Re: Custom Palette Issue

Post by Marscaleb »

Err, yes, by "custom palette" I am referring to a custom PLAYPAL, (which technically is 14 palettes, so I guess I could have been more specific.) And logically yes, there is also a custom colormap.

Here is a wad example. I've stripped out most of the graphics so it can be run as a pwad. Of course, even among the tiles that are there, most of them are going to look like crap anyway because I have not properly tweaked more than a couple tiles to look proper with this custom palette. But you can see the titlepic in there, which is the easy basis for comparison.
If you open the wad in slade you will notice that the graphics in here are remapped from the original Doom2 graphics to work with the new palette.

http://eightballgaming.com/downloads/cPal.wad

But as I said, this a problem that does not occur with other source ports. So either there is some palette settings in the DDF files that I don't know about, or there is something improperly set in source code.

User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

Re: Custom Palette Issue

Post by Corbachu »

You can try editing DDFCOLM (colormaps.ddf) for now -- I will be away from programming for a couple of days, but it sounds like something might be overriding the custom palette. In the past, these were always solved by editing COLORMAP.ddf directly.

Regardless, I will take a look at soon as I can. Main computer went down, and my replacement (an underpowered netbook, of all things) really sucks. Just decided it would be best to wait for my new part to arrive. So, let me know if you are able to get it working properly.

EDIT:
Also, I know the DEBUG outputs some stuff about palette colors, like Black, White, Red, Green, and Blue. Also, while I can't compile, I can still look through the code on Git, so I will check it out later.
\(סּںסּَ` )/ۜ

User avatar
Marscaleb
Posts: 89
Joined: Sat Jun 25, 2016 12:57 pm
Location: California or Utah
Contact:

Re: Custom Palette Issue

Post by Marscaleb »

...huh. I'm noticing a few interesting things about how 3DGE handles new playpal's.

When I have been tinkering with this , I've been running it as an iwad, which started off as a direct copy of Doom2's iwad. For the wad I posted above, I stripped out most of the content, (since at this point it still felt too close to Doom 2's iwad for me to feel comfortable with sharing it online.) And I've noticed a few other differences between how it runs as an iwad versus a pwad.
Except for the wall textures, every art asset 3DGE is getting from the Doom 2 iwad is colored to match how it looks with the original playpal. The flats, the weapons, the weapon effects... Everything is colored with the original playerpal. Wheras when I run that pwad in GZDoom GPL, those items are now colored wrong since they are using the new playpal I supplied.

I guess this isn't really a problem, just an amusing observation. After all, if someone were to make a custom wad with a completely new palette, why would they be using the original textures?

User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

Re: Custom Palette Issue

Post by Corbachu »

Yeah, 3DGE will load what's called a "global palette" in its startup routine, and it looks like it checks for those colors beforehand.

All of the WADS I've ever used have used a different palette but never gave me issues before with their color arrangements, so it is strange that it is happening now.

EDIT:

Yep, check this out, from r_image.h:

Code: Select all

// colour values.  These assume the standard Doom palette.  Maybe
// remove most of these one day -- will take some work though...
// Note: some of the ranges begin with a bright (often white) colour.

#define BLACK   0
#define WHITE   4

#define PINK         0x10
#define PINK_LEN     32
#define BROWN        0x30
#define BROWN_LEN    32
#define GRAY         0x50
#define GRAY_LEN     32
#define GREEN        0x70
#define GREEN_LEN    16
#define BEIGE        0x80
#define BEIGE_LEN    16
#define RED          0xB0
#define RED_LEN      16
#define CYAN         0xC0
#define CYAN_LEN     8
#define BLUE         0xC8
#define BLUE_LEN     8
#define ORANGE       0xD8
#define ORANGE_LEN   8
#define YELLOW       0xE7
#define YELLOW_LEN   1
#define DBLUE        0xF0
#define DBLUE_LEN    8
Assumes the standard DOOM palette after all. . .
\(סּںסּَ` )/ۜ

User avatar
Marscaleb
Posts: 89
Joined: Sat Jun 25, 2016 12:57 pm
Location: California or Utah
Contact:

Re: Custom Palette Issue

Post by Marscaleb »

Well I'm not in a big hurry to get this one fixed, but I wanted to mention it while I still remembered it.

User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

Re: Custom Palette Issue

Post by Corbachu »

Installed my hardware yesterday so I can return to 3DGE now :-)

It seems this has been an issue from as far back as EDGE 1.25. I have some ideas on how to fix it, but it will take a bit of work.
\(סּںסּَ` )/ۜ

User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

Re: Custom Palette Issue

Post by Corbachu »

Here's what andrewj (ajapted) had to say:

The main rule is that EDGE uses the palette that "goes with" the
image. If the image is in the IWAD (like sprites or textures), then
the IWAD palette is used. If you add a pwad which contains images and
a PLAYPAL, those images use the palette in that pwad.

This allows mixing resources with different palettes, e.g. you could
have a map using DOOM textures (with IWAD as DOOM), and add the
HERETIC wad as a pwad and use sprites from that pwad, then all the
colors will be correct.

What other source ports do is any PLAYPAL lump in a pwad overrides the
one in the IWAD. So if you have the DOOM as the IWAD and HERETIC as a
pwad, then all of the resources from the DOOM iwad will have messed up
colors since they are using the wrong palette now (the heretic one).

The downside of the EDGE system is that a new palette never overrides
the existing one in an IWAD and hence never affects the images in the
IWAD. So BTSX (with a modified palette) won't look 100% correct on
EDGE. I presume your modder is hitting this issue.

I don't remember if we added an option or cvar to force using the
"newest" PLAYPAL lump as the palette for all images -- if not, I
suggest you add it.
So, I will work on this next! It makes much more sense - we will add it as an option in DDF (or would a CVAR be preferred?) and let you know!
\(סּںסּَ` )/ۜ

User avatar
Marscaleb
Posts: 89
Joined: Sat Jun 25, 2016 12:57 pm
Location: California or Utah
Contact:

Re: Custom Palette Issue

Post by Marscaleb »

Huh. That might be the right path to follow, but it doesn't fully explain it.
I mean, it is using the new palette in that image, otherwise the image would look noticeably wrong (just testing in Slade, the Cyberdemon would be gray.)
So it IS using the correct pallette, but it is making secondary assumptions about the palette. Specifically, it is assuming that index 247 matches index 0.