Black and white palette

Discuss game and other programming topics not specifically covered in another forum

Moderator: Programming Moderators

User avatar
Uto
Posts: 83
Joined: Tue May 30, 2017 9:33 am

Black and white palette

Postby Uto » Mon Feb 15, 2021 12:41 pm

Hi all,

I was thinking in porting and at the time translating a text adventure I built long ago using ngPAWS (web engine based in PAWS) to Spectrum Next, by using DAAD+Maluva extension, but I have run into a problem when trying to port the graphics.

The game is WW2 based, and so I decided -back in the day- to make the graphics in black and white (or rather, grayscale). Now the problem is despite the Spectrum Next has 256 colours in Layer2, out of a 512 colours palette, not many of them are gray tones, so when trying to convert the graphics I get lots of them converted to same gray tone, and the picture loses a lot of quality. I had tested with colorful VGA 256 color images before, and although the quality was affected due to the reduced palette, it was good enough. Not the case with this images.

I've tried to look at the Next registers, trying to find a B&W setting or similar, but maybe because they are too many register and I can't find it, or maybe because there is no setting like that, I've been unable to find any helpful option.

Do you know if a setting for grayscale palette is available?

Using raster interrupt to change palette every line is not useful this time, because if not a problem of number of colours, but a problem of number of gray colours, there are just not enough of them in the palette.

Thanks in advance.

Alcoholics Anonymous
Posts: 775
Joined: Mon May 29, 2017 7:00 pm

Re: Black and white palette

Postby Alcoholics Anonymous » Mon Feb 15, 2021 4:09 pm

Unfortunately no there isn't a b&w mode. The vga is driven through 3-bit dacs on R/G/B so only discrete levels can be driven. For b&w you are limited to 8 shades:

Code: Select all

RRR GGG BBB
000 000 000 = black
001 001 001
010 010 010
011 011 011
100 100 100
101 101 101
110 110 110
111 111 111 = white
And after that there is dithering and maybe the higher resolution 640x256 helps with that.

I don't know if something good can come out by choosing colours carefully? There are eight shades of red, green, blue and their mixtures amber, purple, etc. Or maybe try intermediate values between the greys to perturb it a little. I don't have too much faith in the last suggestion :P

I guess you could try the flicker method where one frame is one black and white setting and the other is another to mix them together. That's fairly easy to do by switching palettes on frame interrupt. Maybe the flickeriness that ensues won't be too bad on a b&w image.

User avatar
Uto
Posts: 83
Joined: Tue May 30, 2017 9:33 am

Re: Black and white palette

Postby Uto » Mon Feb 15, 2021 5:29 pm

Thanks for the fast reply.

Unfortunately, my painting/drawing skills are close to none, so I'm afraid I'm limited to whatever an automated converter can do. So far I had a 256 color indexed palette picture to layer2 picture, which converts every 8+8+8 color into the closest 3+3+3 color found, and then if more than 256 colours found, takes the 256 used more often, and again converts other colors into the closests color in that 256 color palette. That works pretty fine for coloured pictures, but it does't for a grayscale picture as - as you said - we actually only have 8 gray colors (or actually 6 plus white and black).

I may try to find a good dithering code or software that can help, and maybe take the path you pointed at with the higher resolution. Otherwise, I'm afraid I'll have to find a new artist to make the pictures, something I'm not sure I want because the B&W sttyle was fitting very well the game story.

Well, I'll see what I can do, many thanks again for your help.

Some pictures look more or less OK
decent.png
decent.png (119.44 KiB) Viewed 1031 times
But others, you can't really knon what is there:
not that good.png
not that good.png (96.45 KiB) Viewed 1031 times
Oh! I just spotted a bug (decoRations) :-D

The original picture:
original.png
original.png (638.93 KiB) Viewed 1030 times

User avatar
sol_hsa
Posts: 273
Joined: Fri Jun 02, 2017 10:10 am
Location: Finland
Contact:

Re: Black and white palette

Postby sol_hsa » Thu Feb 18, 2021 8:18 am

Original scaled down to 256 pixel wide, added 5% random (colored) noise, converted to next palette:
Image


Who is online

Users browsing this forum: No registered users and 6 guests