Enhanced palette emulation in Raze

markanini
Posts: 215
Joined: Sat Jan 18, 2020 6:10 am

Enhanced palette emulation in Raze

Post by markanini »

To my eyes the default option with palette emulation disabled reduces the quantization artifacts of the original, greatly improving atmosphere IMO. The downside is that the colors hues and saturation get shifted around, resulting in a generally dull and off-looking colors. This made me consider a way of combining the pluses of both modes using a shader. As a proof of concept I have prepared a ReShade package.
https://www.dropbox.com/s/4snzt7l71ur0e ... e.zip?dl=0
Extract it into your Raze directory, run Reshade Setup, and it should get picked up on startup. Just remember to leave palette emulation disabled. Currently only Blood is supported.

Disabled/Enabled/Mine

(Click to see animation)

(Click to see animation)
Last edited by markanini on Fri Feb 28, 2020 4:18 pm, edited 2 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Enhanced palette emulation in Raze

Post by Graf Zahl »

markanini wrote:To my eyes the default option with palette emulation disabled reduces the quantization artifacts of the original, greatly improving atmosphere IMO. The downside is that the colors hues and saturation get shifted around, resulting in a generally dull and off-looking colors.
Actually, I think it's the palette shades that look off. This same shift to red can be observed in all of the Build games in the brown colors which makes me believe that the generation tool was bugged, because aside from this quirk the shade tables are relatively well composed.
markanini
Posts: 215
Joined: Sat Jan 18, 2020 6:10 am

Re: Enhanced palette emulation in Raze

Post by markanini »

Thanks for the feedback!
markanini
Posts: 215
Joined: Sat Jan 18, 2020 6:10 am

Re: Enhanced palette emulation in Raze

Post by markanini »

For Shadow Warrior

(Click to see animation)

(Click to see animation)

Download: https://www.dropbox.com/s/b9qp2ku4te9mn ... e.zip?dl=0
Last edited by markanini on Sun Mar 01, 2020 5:20 pm, edited 2 times in total.
User avatar
Phredreeke
Posts: 314
Joined: Tue Apr 10, 2018 8:14 am

Re: Enhanced palette emulation in Raze

Post by Phredreeke »

Graf Zahl wrote:This same shift to red can be observed in all of the Build games in the brown colors which makes me believe that the generation tool was bugged, because aside from this quirk the shade tables are relatively well composed.
Maybe, maybe not. It brings to mind the CGA palette of all things, where the dark yellow has its green intensity halved.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Enhanced palette emulation in Raze

Post by Graf Zahl »

You mean the EGA palette, don't you? That's the one with 16 colors.
User avatar
Rachael
Posts: 13969
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Enhanced palette emulation in Raze

Post by Rachael »

That was introduced with CGA, though only for text mode, but yeah, that's the one.
User avatar
Phredreeke
Posts: 314
Joined: Tue Apr 10, 2018 8:14 am

Re: Enhanced palette emulation in Raze

Post by Phredreeke »

The CGA palette is 16 colors, the EGA palette is 64 colors but for compatibility reasons limited to the 16 colors of the CGA palette in the 320x200 and 640x200 modes. Of course, CGA can't display all 16 colors at once except in text modes.
markanini
Posts: 215
Joined: Sat Jan 18, 2020 6:10 am

Re: Enhanced palette emulation in Raze

Post by markanini »

OP updated with animations for easy comparison.
Graf Zahl wrote: Actually, I think it's the palette shades that look off. This same shift to red can be observed in all of the Build games in the brown colors which makes me believe that the generation tool was bugged, because aside from this quirk the shade tables are relatively well composed.
BTW, don't you think it's a bigger problem that browns a reds tend toward dark lime? I see a bit of the tissue you are talking about, you might find with it's not as much with my method.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Enhanced palette emulation in Raze

Post by Graf Zahl »

markanini wrote: BTW, don't you think it's a bigger problem that browns a reds tend toward dark lime? I see a bit of the tissue you are talking about, you might find with it's not as much with my method.
The red tint of browns was what I noticed first, but I find any kind of color change in such a shade table problematic - these aren't as bad as Heretic, though - that one is doing some really weird voodoo.
markanini
Posts: 215
Joined: Sat Jan 18, 2020 6:10 am

Re: Enhanced palette emulation in Raze

Post by markanini »

At least with a title like Blood they have an excuse for such color shifts. :wink:
User avatar
Fox666
Posts: 139
Joined: Thu Feb 24, 2011 12:45 am

Re: Enhanced palette emulation in Raze

Post by Fox666 »

Graf Zahl wrote:
markanini wrote:To my eyes the default option with palette emulation disabled reduces the quantization artifacts of the original, greatly improving atmosphere IMO. The downside is that the colors hues and saturation get shifted around, resulting in a generally dull and off-looking colors.
Actually, I think it's the palette shades that look off. This same shift to red can be observed in all of the Build games in the brown colors which makes me believe that the generation tool was bugged, because aside from this quirk the shade tables are relatively well composed.
I don't see anything wrong with Blood's shade table.

By superimposing a black gradient over the palette, I get very similar results converting the palette in Photoshop.

I think it's just a visual thing, the game relies too much on indigo or yellow colors, and when darkened the closest match is brown.
markanini wrote:To my eyes the default option with palette emulation disabled reduces the quantization artifacts of the original, greatly improving atmosphere IMO. The downside is that the colors hues and saturation get shifted around, resulting in a generally dull and off-looking colors. This made me consider a way of combining the pluses of both modes using a shader. As a proof of concept I have prepared a ReShade package.
https://www.dropbox.com/s/4snzt7l71ur0e ... e.zip?dl=0
Extract it into your Raze directory, run Reshade Setup, and it should get picked up on startup. Just remember to leave palette emulation disabled. Currently only Blood is supported.
That's very interesting, it seems to be doing a good job in preserving the contrast of the original ART.

Did you achieve that by averaging the RGB shifts for each color index in the shade table?

EDIT: Looks like you just overlayed the images, using the hue of one and the brightness of another.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Enhanced palette emulation in Raze

Post by Graf Zahl »

Fox666 wrote:
Graf Zahl wrote:
markanini wrote:To my eyes the default option with palette emulation disabled reduces the quantization artifacts of the original, greatly improving atmosphere IMO. The downside is that the colors hues and saturation get shifted around, resulting in a generally dull and off-looking colors.
Actually, I think it's the palette shades that look off. This same shift to red can be observed in all of the Build games in the brown colors which makes me believe that the generation tool was bugged, because aside from this quirk the shade tables are relatively well composed.
I don't see anything wrong with Blood's shade table.

By superimposing a black gradient over the palette, I get very similar results converting the palette in Photoshop.

I think it's just a visual thing, the game relies too much on indigo or yellow colors, and when darkened the closest match is brown.
That may be and if only one game showed that trait I'd just blame it on the available colors - but I've seen the same red-shift quirk not only in Blood but also in RR and SW. And it's only visible in a very narrow range of hues that's virtually identical in all games. That's what made me suspect that the color matching algorithm tends to have a slight red bias.
Teddipetzi
Posts: 42
Joined: Sat Aug 17, 2019 2:32 am
Graphics Processor: nVidia with Vulkan support

Re: Enhanced palette emulation in Raze

Post by Teddipetzi »

Graf has a point. I also noticed that the palette emulation tends to exaggerate red in some colors.
It doesn't really bother me that much in Blood or Redneck Rampage,balthough I still prefer the more natural look of the true color option, but in Shadow Warrior it really put me off, it affects too many colors and gives the entire scene an unnatural look if brown - especially reddish browns are the predominant color.
markanini
Posts: 215
Joined: Sat Jan 18, 2020 6:10 am

Re: Enhanced palette emulation in Raze

Post by markanini »

Fox666 wrote:Looks like you just overlayed the images, using the hue of one and the brightness of another.
Correct. EDIT:Actually I stacked a truecolor layer in Photoshop in luminosity mode, thereby passing through hue and saturation. Same thing for the Hald CLUT I made for my shader. My solution works right for fullbright sectors. An internal shader in Raze with the same function would work ideally in a all circumstances.
Post Reply

Return to “General”