VOGONS


First post, by Great Hierophant

User metadata
Rank l33t
Rank
l33t

True VGA can display 18-bit color, with 6-bits for R, 6-bit for G and 6-bits for B. Modern graphics adapters typically display 24-bit color, with 8-bits for R, 8-bits for G and 8-bits for B. 24-bit color must be able to show more colors than 18-bit color.

I would assume that to convert a 6-bit value into an 8-bit value, the conversion would work like this:

6-bit color value 0 = 8-bit color value 0
6-bit color value 1 = 8-bit color value 4
6-bit color value 2 = 8-bit color value 8
6-bit color value 3 = 8-bit color value 12

and so on. Thus, when displaying VGA graphics, no palette entry should contain any number other than a multiple of 4. But this assumes a linear conversion of graphics.

Now, when using monochrome graphics on VGA, where the color value for R = G = B, only 64 colors should be available, since each color value is 6-bit. IBM indicates that the color values for R, G and B are summed and output on the green VGA pin for a monochrome display. But some games advertise 256 colors with their gray scale drivers on monochrome monitors (Sierra SCI 256-color games, Pinball Fantasies). This was long before SVGA and 8-bit palette DACs. How can they do this?

http://nerdlypleasures.blogspot.com/ - Nerdly Pleasures - My Retro Gaming, Computing & Tech Blog

Reply 1 of 7, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie
Great Hierophant wrote:

Thus, when displaying VGA graphics, no palette entry should contain any number other than a multiple of 4.

The proper conversion factor is 255/63 = 4+1/21 ~ 4.04. It's true that many people just multiply by four, in which case white is not really white. The mistake is greater when starting with less than six bits, as is the case with some 8-bit console emulators. Earlier versions of MESS, for example, had the PC-Engine driver only go up to 224 for that very reason.

Great Hierophant wrote:

How can they do this?

They don't tell the truth, knowingly or unknowingly.

Reply 2 of 7, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

A simple, integer-based transform for promoting lesser-bit RGB values to 8-bit:

6-bit: C8 = (C6 << 2) | ((C6 & 0x30) >> 4)
5-bit: C8 = (C5 << 3) | ((C5 & 0x1c) >> 2)
4-bit: C8 = (C4 << 4) | C4

Using the high bits to fill in the low bits creates a linear ramp to give the full 0 through 0xff range, and avoids using floats.

Reply 4 of 7, by Great Hierophant

User metadata
Rank l33t
Rank
l33t

I suppose that if you started at the white end of the spectrum, where 63 = 255, 62 = 251 and so on, you would have the darkest black at 3,3,3 (8-bit). My eyes cannot personally tell a difference between 252,252,252 and 255,255,255 or 0,0,0 and 3,3,3.

I thought that 256 colors on a conventional mono VGA monitor was impossible, but I wanted to make sure there was nothing I overlooked.

http://nerdlypleasures.blogspot.com/ - Nerdly Pleasures - My Retro Gaming, Computing & Tech Blog

Reply 5 of 7, by kolano

User metadata
Rank Oldbie
Rank
Oldbie

I think the problem that the poster has is that in grayscale you only have 64 increments given a 18b palette. Even in a full 24b palette, you still only have 256 shades of grey. What one needs to realize is that even 64 shades of grey is a lot, having played with just the 16 shades of grey you get from a 4b palette. 16 shades provides a fairly realistic image, 64 is even better, the full 256 shades one gets later on is great, but probably more than is needed to provide an acceptable image.

This frequently comes up in various eyecandy software where we would try to fill the palette with shades of rgb, but run out when 64 shades of red, green, and blue would only fill 192 of the available 256 colors, and even 125 colors of running up and down available colors would still frequently leave gaps due to overlap. This is why when you see full RGB palettes in eyecandy software there was often bars of black between the colors, where the full spectrum of RGB colors possible didn't cover the full palette.

If you are using VGA, the greyscale colors you output only cover 64 palette entries. That's more than enough to provide fairly realistic image rendering, but fewer than most folks would think to be comfortable with. You have to remember though, that even the 16 shades of grey provided by the standard VGA modes provide enough gradation that many people won't notice. Yes, humans can distinguish more than 64 greyscale colors, but even a few are enough to to provide fairly realistic imagery.

Per the posters original point though, greyscale VGA is only producing 64 colors, not 256 as advertized. You can game the system a bit by moving colors forward individually, rather than all at once. 1,1,1 > 1, 1, 2 > 1,2,2 > 2,2,2 > 3,2,2 > 3, 3, 2 > 3, 3,3 . These won't be exactly greyscale colors, but will expand the bar rendered.

Eyecandy: Turn your computer into an expensive lava lamp.

Reply 6 of 7, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie

A mono VGA monitor can display 256 shades of gray if it takes the *color* input on the RGB pins and performs the summing in the analogue domain, though.

I suppose that if you started at the white end of the spectrum, where 63 = 255, 62 = 251 and so on, you would have the darkest black at 3,3,3 (8-bit).

No. 255/3 as a conversion factor starts at 0 and ends at 255. 4 as a conversion factor starts at 0 and ends at 252.

Reply 7 of 7, by phillipsjk

User metadata
Rank Newbie
Rank
Newbie
Great Hierophant wrote:

Now, when using monochrome graphics on VGA, where the color value for R = G = B, only 64 colors should be available, since each color value is 6-bit. IBM indicates that the color values for R, G and B are summed and output on the green VGA pin for a monochrome display. But some games advertise 256 colors with their gray scale drivers on monochrome monitors (Sierra SCI 256-color games, Pinball Fantasies). This was long before SVGA and 8-bit palette DACs. How can they do this?

You appear to be missing two things:
6bits per RGB color channel actually implies about [del]2000[/del] 512 shades of grey ([del]12 bit colour- 1 bit[/del] 6 bit colour+ 3 bit (colour channels)).

The reason is that the green color channel has about twice a much brightness information as the other two clours. (In that link Green is weighted 0.587) As a result, (1,0,1) should appear to be about the same brightness as (0,1,0). I am not sure why the limit is 256 colours. It may be a limitation of the 6 bit DAC's accuracy (0.7 volts/256shades = 2.73mV; 0.7 V/64 shades = 10.9mV)
Edit: now I am second-quessing myself: 64 shades with half-steps between would be only 128 shades. Maybe kolano has it right with Blue channel serving as a 1/4 step.

  • R'G'B' sub-step -- resulting percentage of full step
  • (0,0,0) -- 0%
  • (0,0,1) -- 11.4%
  • (1,0,0) -- 29.9%
  • (1,0,1) -- 41.3%
  • (0,1,0) -- 58.7%
  • (0,1,1) -- 70.1%
  • (1,1,0) -- 88.6%
  • (1,1,1) -- 100%

The second thing you are missing, mentioned in the post immediately preceding mine, is that math can be done in the analog domain. The weightings of 0.299 (red), 0.587 (green) and 0.114 (blue) can be chosen with appropriate resistor values.