Why using black as a color instead of leaving the pixel "empty"?

Started by cwpab, 10:48, 08 March 25

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cwpab

I'm curious about this, I thought about it years ago and only today I remembered to do some research.

Some games, like Saboteur or International Karate, seem to have 4 color palettes that include black.

Would it be possible to "achieve" 5 colors + black by simply "disabling" those pixels instead of giving them a "black" value?

Or would the screen not be totally black if the pixels are "empty"?

(I guess this works for most computers and consoles, not just the CPC, and of course for mode 0 too)

andycadley

The restriction on the number of colours per pixel comes from the number of "bits" used to represent each pixel. Two bits give you four combinations, hence four colours.

If you had the ability to turn a pixel "off" you'd need another bit to represent that state. But at three bits per pixel you might as well have eight colours, rather than an on/off switch.

robcfg

As Andy said, you cannot disable pixels, but you can choose not to use black in your palette and play with colour patterns to give the illusion of more that 4 colours.

The way the image is generated is that the CRTC and the Gate Array scan the video memory area and they use the values read to output the desired colours.

2 bits per pixel gives 4 combinations (2 to the power of 2 equals 4), and you assign a colour to each of these combinations (that would be your 4 colour palette) so that every time your 2 bits are 0, it will show you Black, for example, if you assigned it that way. But as said, you can assign Pink to value 0, so using black in a palette is a choice and not a limitation.

Last, but not least, as Andy also pointed out, if you add an extra bit to signal whether the pixel is on or not, instead of using it to have 4 colours + Black, you could have 8 (2 to the power of 3) colours, including Black, at the expense of memory consumption and memory alignment problems.

Because, let's be honest, in a system with packets of 8 bits, using 3 makes it more difficult to work with them (you could have 2 full pixels and then 2 loose bits, which maybe you could use for on/off signals), but in the end it would be far easier to use 4 bits per pixel and have 16 simultaneous colours...

cwpab

I thank you both very much, but at the same time I must confess I don't understand much. But I'm glad there's a quick answer for this!

Since it's apparently not possible to leave pixels "empty" as I imagined (this was predictable: game developers would have done this if possible!), sadly... I will try to rephrase the question, so that maybe the answers are more digestable for me.

1) What happens if you (voluntarily) "forget" to draw something in a part of the screen? Does it appear all black (I guess not!)? Does it show some graphical "noise"? The previous graphic that was there?

2) Or maybe this isn't even possible? Maybe (at least on the CPC) drawing every part of the screen is "mandatory"?

3) There is at least one system that can do this: the Vectrex, with its obvious black backgrounds because the graphics are simply lines, etc. But ZX Spectrum also have many games with black backgrounds: Do these games have "black defined as a color" for the background? And what about other systems?

Thanks again! Bit of a graphical programming dummy over here.

andycadley

Both the Spectrum and Amstrad use bitmapped graphics. A chunk of memory holds "the screen".and the hardware just periodically reads that memory and uses it to produce an image. If you don't "draw" anything, it just keeps on displaying what was there previously.

arnoldemu

Simple answer: gate-array is drawing the screen every frame and reads pixels  from ram so you will see that.
In general that is what happens.

Using some tricks you can only really show 'nothing' if you make a screen which can't be displayed by the monitor and it looses sync but it's not useful and depends on monitor etc.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

The way to achieve more colours is to re-program the palette as the screen is drawn which changes the colours for the pixels. You must do this every frame for the effect to stay active because once you stop doing it then the  last palette you set is used. With this method using cpu time every frame and careful timing may be needed often the game would have one palette for the main play area and another palette for the hud.


BTW: The vectrex is a 'vector display' and the cpc is a 'bitmapped display'. 
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

andycadley

It's probably also worth noting that how machines choose colours varies too. On the Spectrum a pixel with colour 0 is always black, a pixel with colour 1 is always blue etc (how you decide what colour a pixel is turns out to be a whole other kettle of fish). This means the "palette" of colours is essentially fixed.

By contrast,.the Amstrad uses a dynamic palette. A pixel in "colour 0" could be any one of the 27 available colours, as the hardware maintains a lookup table telling it which possible pixel colour maps onto which target colour. 

GUNHED

Quote from: andycadley on 11:16, 08 March 25The restriction on the number of colours per pixel comes from the number of "bits" used to represent each pixel. Two bits give you four combinations, hence four colours.

If you had the ability to turn a pixel "off" you'd need another bit to represent that state. But at three bits per pixel you might as well have eight colours, rather than an on/off switch.
Very well explained. Saves me typing the answer.  ;) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

McArti0

10 r=&BCFF:d=&BDFF
20 OUT r,7:OUT d,16
30 OUT r,6:OUT d,12
40 OUT r,4:OUT d,18
50 OUT r,0:OUT d,127
60 OUT r,5:OUT d,4

example empty pixel in empty line  ;D
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
One chip driver for 512kB(to640) extRAM 6128
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

Anthony Flack

For anybody who knows how this all works the question seems nonsensical, but it's interesting to imagine from the perspective of somebody who doesn't. 

As Andy says, each pixel on the screen is tied to a memory location which determines which colour the pixel should be. The memory location can be storing a zero, for colour zero, but it can't hold "nothing". Zero is one of the available colours.

There is a way to turn pixel drawing "off" and access one more colour, and that is the border colour. There are restrictions on how the border controls work that make it difficult to do anything with it except draw the border, but it is possible to create non-rectangular borders. The border is the closest thing to "off pixels" that we have. 

ZorrO

Good example how to use more colors in MODE 1 is game Fugitif:
https://www.cpc-power.com/index.php?page=detail&num=931
Click second icon from left this one look like film, there is slideshow with 70 pictures. :)

CPC+PSX 4ever

Anthony Flack

The art style is a little bit naive, but it still looks great. The colours really pop. Watching it all in slide show you see how much effort they put in. Shame it didn't sell more.

MaV

The original picture is the art for the box and book covers of the Matra Alice computer:
https://www.obsolete-tears.com/matra-hachette-alice-machine-17.html
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."


Anthony Flack


Powered by SMFPacks Menu Editor Mod