Recent

Author Topic: Is this technique obsolete?  (Read 3631 times)

RWC

  • Jr. Member
  • **
  • Posts: 92
Is this technique obsolete?
« on: October 13, 2016, 09:09:49 pm »
I’m using BGRABitmap to simulate an old program technique I developed when I got my first VGA color monitor.

We had for the fist time, 256 colours to play with in DOS. We were stunned by the image quality. At just 320x240 pixels, only half the resolution of the 16 colour mode it was great for graphics but particularly good for photographics. Even today VHS & Betamax tapes of similar resolution are still used and can look far superior to some of the highly compressed videos seen online & via Satellite.

So the lesson learned was that more colours to blend was more important than resolution. The limitation was of course the palette. It had to be optimised for each photo so could not be displayed with another photo nor have effects applied like fading, brightness, contrast etc. at least not in any practical way (Hence the dark and garish colours used in later games such a Wolfenstein).

A solution to these problems was inspired by the BBC research engineers. They developed the PAL system to circumvent the problem of colour distortion caused by poor weather shifting the phase of the colour component during transmission. e.g. reds going too orange or blues too green.

Every alternate scanline was phase reversed (hence Phase Alternate Line) so the ‘off colours’ on one scanline seen next to the reversed ‘off colours’ on the next scanline was visually perceived as the correct colour. (the American NTSC system was often referred to as Never Twice Same Colour).

So my solution was to halve the resolution yet again to 160x120. I could then use 4 pixels to represent more colours and then blend, fade, change hue, brightness contrast etc, all with the same 256 colour palette.

The attached main image shows a RGB of four pasted 256 colour images all sharing the same palette. The histogram shows the 256 colours. The second histogram shows just the top right tiger colours before processing. The top left is the palette colour gradients. They appear smooth but are 64 equal steps from 255 to 3, i.e 255,251,247…19,15,7,3.

I’m representing the 8bit images as an RGB because I’ve not yet worked out a way to embed my own palette table nor how to save an 8bit file from BGRA.

The question is, is this technique now obsolete or is there a modern use for it?
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

circular

  • Hero Member
  • *****
  • Posts: 3440
    • Personal webpage
Re: Is this technique obsolete?
« Reply #1 on: October 14, 2016, 09:15:00 am »
That's an interesting idea.

You can save in 8bit by doing the following:
Code: Pascal  [Select][+][-]
  1. uses BGRABitmap, BGRAWritePNG;
  2. var writer: TBGRAWriterPNG;
  3. begin
  4.   writer := TBGRAWriterPNG.Create;
  5.   writer.Indexed := true;
  6.   bmp.SaveToFileUTF8('4up_LowRes8bit.png', writer);
  7.   writer.Free;
  8. end;

However I am not sure there are only 256 colors. Indeed if you have 64 levels per channel, the total number of RGB colors is 64x64x64 = 262144

If you add alpha, that would be 262144x64 = 16777216

Something you mention about blending different hues together could indeed help reducing the number of colors.

Basically this is the idea of dithering. It is still useful with 32bit displays for example if you want to represent a picture with more than 32-bit quality. You can do that by doing some dithering.

That could be interesting to add more ditherings to BGRABitmap. For now I've only implemented Floyd-Steinberg in BGRADithering unit.
« Last Edit: October 14, 2016, 09:27:24 am by circular »
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 3699
  • Leandro Diaz
Re: Is this technique obsolete?
« Reply #2 on: October 14, 2016, 11:12:13 pm »
I remember I asked you for the dithering and I never used it  ::) I must try that.

I don't understand very well the idea, so I can't give my opinion of it.

circular

  • Hero Member
  • *****
  • Posts: 3440
    • Personal webpage
Re: Is this technique obsolete?
« Reply #3 on: October 14, 2016, 11:24:37 pm »
I can explain.

Suppose you have a palette that contains a reduced number of colors. If for each pixel you replace it by the nearest color you can find in the palette, you will get an image that looks like the original, but with less colors.

If you have a gradient in the original image, then you will get a series of bands after reducing the number of colors.

For each pixel, there is an "error", a difference between the color with reduced colors and the original image. The principle of dithering is to correct the error by trying to cancel the difference by changing other pixels around it.

For example, you can make some gray by alternating black and white pixels. Or some orange by alternating red and yellow pixels.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 3699
  • Leandro Diaz
Re: Is this technique obsolete?
« Reply #4 on: October 14, 2016, 11:45:38 pm »
Ok I got it. We're all the time talking about Dithering  ::)

Is often used with new videogames that want to achieve an old look & feel of old videogame consoles, often called 8-bit era.

circular

  • Hero Member
  • *****
  • Posts: 3440
    • Personal webpage
Re: Is this technique obsolete?
« Reply #5 on: October 14, 2016, 11:48:37 pm »
Indeed.  :)
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018