GFX - Photorealism: ways to convey the desaturated colors inherent in real photographs

Photorealism 
Alone Coder 

 On a regular attribute screen, quite 
It’s not easy to convey desaturated colors when─ 
real photographs. 
 In the mid-90s, many tried to use─ 
call for this the flickering of three screens (R, 
G,B), but it looked unpleasant to the eye. 
There was also an option with twin screen flickering─ 
us (2-color, if the previous option is on─ 
call 3-color, and the whole idea is X-color). B 
including its varieties with alternation 
interlaced screens ("gigascreen" as they are called) 
deviceSchemeMan ) or waves 
(demonstrated at demoparty Forever). 
 Separatelyflickering can be considered 
two screens with multicolor (for example, in 
Eye Ache 2, with a show-off called 2048-color─  
nom). 
There was also an option fromVolga Soft (demo Free
Art ), where the picture was built alternating  
lines of three colors. 
 In  8 color editor there was a compromise wa─ 
riant - interlaced flickering of three screens─ 
new, that is, from three color components 
only one is not visible each time. For this 
it was possible to at least watch without pain, but 
the picture turned out to be too dark, and the background─ 
this is almost all the processor time. 
Everyone can imagine how much 
different combinations can give rise to different 
combinations of the number of screens, pixel sizes─ 
la, multicolor step and specific edges─ 
attribute values. For example, inZX-Guide #2 
I counted 44 of them, and these were not all variations─ 
nts. But which of these combinations is the most 
Does effectively convey real color? 

 1. Set of shades

   Flickering of three screens gives on average,
certainly all colors, but every pixel
can only be colored by one of the standard─
rt of eight. Possibility to generate from─
specific attributes for each familiarity
each of the frames was considered, in part─
ness, on the Commodore stage, but hardly
someone saw practical results.
   As a result, gigascreen can provide more re─
al colors, despite all its limitations─
nia. But the problem is gigascreen and others
ways to flash two screens - impossible─
The need to standardize the result is funny─
niya flowers.
   The fact is that on Pentagon brightness 
BRIGHT=0  and 1 differ approximately twice, and 
on branded cars - very insignificant─
but. And the correspondence to the combination of black + color is
specific brightness of the non-blinking grid of this
colors - depends not only on gamma characteristics─
teristics and afterglow time, but even
from the current monitor settings.
   Used for a long time agreed─
ny with Diver (he used it on his
"Scorpio" dim ratio = 50% set─ 
very bright, which is especially visible in the picture
"Alone") standard that black+bright equals─ 
has a dim color. This standard is also called─
bathroomAlone,gives a minimum of colors - just
83, but predictable if the user
will configure its screen taking it into account (usually
There were enough brightness and contrast knobs). Magazine
Info Guide for photographs always use─ 
this particular standard has been in use since those times
when edited on real"Pentago─
not". The problem is that later itself Diver 
abandoned this standard in favor of pa─
litersPulsar.Cars are now being drawn for it─
teens on demoparty shown in emulator
without flickering and also (historically incorrect─
ktno) called "gigascreen". Of course
this palette does not match the brand
iron, and even its scatter is unknown
characteristics.
   That is, whatever one may say, but using 2-
color is general, you cannot calculate─
It is clear that foreign users (the main
consumer products  "48K only" and "128K
only" ) will see your image correctly. 
 Is it possible to somehow limit 2-color for
more compatibility? Undoubtedly.
   The simplest way out is to stop using─
reducing brightness and dividing the picture into two
layer with known characteristics. Admission─
tim, a layer of color and a layer of b/w. Promising for
colored chunks, but no prospects for pho─
tography - precisely because of the problem in the title─
vke: we are limited to only six planes─
we are in a color cube, which you don’t even fit in─
the body is falling apartcolor transition.
   Another option was used inCrazy
Love - select specific two colors on 
black background and convert to them. But this
again limits the number of shades. Not even
you get the classic cyanotype combination
+ sepia (this is what was called in history
cinematography with the term "multicolor"), ra─
what to replace orange with red or,
let's say yellow - but in the second case you
you will be left without white.
   Can use three colors with multi─
color, as mentionedVolga Soft.Or what─
tyre, like on our cube in the intro (it,
By the way, it also works on the proprietary 48K ). But
It must be taken into account that individual color lines
can be filtered by encoding. In that place─
the colors were barely visible after the projector,
when we tested it on "Cosmonav Day─
ta" in 2019. 
 Of interest R-Mode (under 128K )
- variation of 4 color layers, where attributes
not fixed, but no brightness and acceptable
onlyseveral color combinations (one
the layer only uses the 0B and 0Y attributes,
another is only 0R and 0C, the third is 0G and 0M,
the fourth is always 0W, attributes are displayed 
push in the top border). This mode I 
tried to break through back in the days of ACNews
#59, but so far not a single re─  has been released
Lisa using it. Perhaps because
that gfx makers specializing in betting─
versions in6912,helpless in other videos─
modes, and artists who draw themselves
give up starting without specialized
convenient tool.

 2. Visible defects

   In the case of photographs, blur the borders
you won’t get acquainted with planning a drawing─
tsya. Therefore, all the defects of the chosen method
in terms of using squares will look like─
us. Specifically, converted 2-color
always contains visible squares, and multi─
color orMCX (multicolor on 2 screens) -
visible stripes. Moreover, these stripes are wounds─
blast furnace, so contrary to intuitionR-Mode
looks better thanMCX,despite the huge─
many restrictions and huge savings
CPU time! You can easily compare─
threadMCXandR-Modein the converterCon18 - not
I know other converters with these modes,
so I refer to mine.
   Visible defects also occur due to mention─
that problem of palette mismatch (correspondence─
wearing brightness, gamma characteristic,
afterglow curve) from the author of the picture and
at the user.
   There are other problems associated with
boundaries of a familiar place. Known, for example, trouble
"Pentagon"  showing the sequence 
familiarity  ink N (paper is not important), paper N
(ink is not important), where the pixels are adjacent,
it would seem to be the same color, but in reality
there is a stick between them.
   Nonlinear distortions are also known
borders of flowers. For example, at first
pictures of us in the magazine flickered through the atri─
8x8 rubble mesh, and it looked real─
flax"Pentagon"better than blinking all together─
important attributes - due to the fact that the frames
were less differentfrom each other by eye and
did not result in different scaling
lines on CRT due to different brightness. But by─
it turned out that some people use─
the mesh only worsens the view, so
I had to give it up.
   Of course, now it is no longer customary to bet
imagine monitors with distortions at the edges
colors and scaling and shifting of lines
depending on their color, but without knowing re─
al iron and drawing or converting under
emulator with neat square pixels─
lyami, gfx maker risks slipping into a fake─
beat and hipsterism.

 3. Dynamic range

   One of the simplest solutions in case of cha─
NKOV 4x4 - apply one bright color to
different bright color.This is time-tested
method. It can be drawn interlaced,
as in Eye Ache 2,Anamnesis orStellar
Contour, thus eliminating the hellish 
blinking due to loss of clock cycles. You can even
alternate bright and dim lines - carried─
despite the incompatibility of levels, in this
In this case, almost no one will notice the difference. By─
what? Because there will be only 64 flowers,
they are all “meaningful”, without any strokes─
wok and other color transitions.
   Buttry converting the photo─
fiyu in 64 standard colors (this option
available inPhotoshop)without shading. Is it good?
No good! Even the mentioned option,
when the second layer is black and white, it looks better.
Because there is at least some kind of regulation─
Brightness adjustment. Even black and white photography
even more beautiful with shading!
   So we gradually come to the conclusion that
The vividness of the photograph is ensured by the speakers─
tical range, or, in any case,
it greatly influences the result.
   One 4x4 cage holds only 16
pixels are 17 brightness levels. And this
It's a big cage, where we lose details.
If you use a 4x4 grid on the cells
smaller size, we will still be the same─
remove details. If you use the spread─
noise reduction type Floyd-Steinberg,we all
We will still lose details, albeit less.
   Now tell me - have you seenZX-Stag?

 4. No, we are decent boys

   So - when several alternate
pictures with different shading phases, not enough
the stats of these hatchings compensate for each other
friend. Eyes, brains and other tripe somehow
Then the average brightness is calculated. When─
how do they calculate it over the course of a whole second─
or so, judging bymy experiment─
ntam.And a few more results from these ex─
experiments. The more often the pictures change,
the better the result. The less noticeable the qi─
kly, the better the result. Than pictures more─
The more similar, the better the result. The better
each picture looks like separately -
the better the result.
   We immediately dismiss the storage of 16 independent
pictures for each 4x4 shading phase. On
128K  of bourgeois RAM every kilobyte on 
account. (If you want a Spectrum without any problems, bye─
you burnATM. ) Therefore, we will hatch about─
grammatically.
   To hatch programmatically, we need
image image with a color depth of 4 bits per
pixel and in a convenient format.
   Shading formula:

pixel = pixture[y][x] > chunkpixelnumber 
 [(y+yshift)&3, (x+xshift)&3];

   Where:

int chunkpixelnumber[4][4] = { 
 {0x0, 0xc, 0x2, 0xe},
 {0x8, 0x4, 0xa, 0x6},
 {0x3, 0xf, 0x1, 0xd},
 {0xb, 0x7, 0x9, 0x5} 
}; 
x, y = 0..3;xshift, yshift depend on the frame number. 
Let's say they gallop with the horse's move. 

 But if we tinker with each peak─
flood, then the picture will be updated too─
com slowly. Therefore, let’s find the most popular─
ary groups of 4 pixels (if the difference is 1
brightness level - we consider that it coincides) and
we output like this:

 pop bc ;4pix + 4pix
 ld l,c
 ld a,(hl) ;%abcd0000
inc h
 ld l,b
 or (hl)  ;%0000efgh
 ld (de),a
inc e
 pop bc ;4pix + 4pix
 ld l,b
 ld a,(hl) ;%0000efgh
dec h
 ld l,c
 or (hl)  ;%abcd0000
 ld (de),a
inc e 
;47 t/b (a little more than 4 frames full screen) 
;Tables = 16*2*256 = 8K. 
;Image image = 12K. 

 So this program along with the data
fits even in48K.Even inTimexwith up─
parallel multicolor when lining me─
todomVolga Soft.But practice has shown that
the three-line layout greatly spoils the de─
waist, and Timexes  are unpopular today.
(Is it possible to display these attribute stripes
on the original 48K? It’s possible, I wrote this
code, but it’s very bold, and it’s time-consuming
the effect does not remain)

 5. How do we color the picture?

   It is clear that video modes that devour pro─
processing time, are not suitable for such in─
intelligent output. So as a
let's take video mode R-Mode.Con18 can
upload not only itself R-Mode (pixels with
attributes), but also 8-bit models of its layer─
ev, and we will throw away the pixels and use
onlyattributes and these layer models.
   Resolution of each layer - 96x256, total
4 layers, so the image image will take 24K.
It's still within acceptable size limits.
lower memory and a stub of the 7th page, where
lies one of the used screens.
   You just need to fit the drawing more beautifully─
224 clock cycles allocated to one line─
ku, because each line must be switched
screen number. We write like this:

mcpush1q 
 if PENT
 ds 1
 else
 ds 11 ;10=glitch at the top right on +3
endif 
mcnoisepicH=$+2 
ld sp,repic 
mcnoisescraddrH=$+2 
ld de,0x4000 
curchunkH=$+1 
ld h,rebyte1/256 
mcloop0 
;max +122 (119-1,120-1 or 126-1 (ld h,N)) 
 exx
 out (c),d ;screen change at +138
 exx 
;+142 
       pop bc ;4pix + 4pix
       ld l,c
       ld a,(hl) ;%abcd0000 ;slowmem
       inc h
       ld l,b
       or (hl)   ;%0000efgh ;slowmem
       ld (de),a ;slowmem 
;+185 
       pop bc ;4pix + 4pix
       ld l,b
       ld a,(hl) ;%0000efgh ;slowmem
       ld l,c 
;+210 
        pop bc ;4pix + 4pix ;!!!!!!!!!
       inc e
       dec h
       or (hl)   ;%abcd0000 ;slowmem 
;+235 = +7 
       ld (de),a ;slowmem (write at +16) 
;+16 
       inc e
       ld l,c
       ld a,(hl) ;%abcd0000 ;slowmem
       inc h
       ld l,b
       or (hl)   ;%0000efgh ;slowmem 
;+48 
       ld (de),a ;slowmem (write at +55) 
;+56 
       pop bc ;4pix + 4pix 
;+66 
       inc e
        nop ;!!!!!!!!!!!!!!!
       ld l,b
       ld a,(hl) ;%0000efgh ;slowmem
       dec h
       ld l,c
       or (hl)   ;%abcd0000 ;slowmem 
;+104 
       ld (de),a ;slowmem (write at +111) 
;+112 
;----------------- 
        inc e
        exx
        out (c),e ;screen change at +132
          ;(nowait),нельзя сдвинуть назад
        exx 
;+136 
       pop bc ;4pix + 4pix
       ld l,c
       ld a,(hl) ;%abcd0000 ;slowmem
       inc h
       ld l,b
       or (hl)   ;%0000efgh ;slowmem
       ld (de),a ;slowmem
       inc e ;47 
;+183 
       pop bc ;4pix + 4pix
       ld l,b
       ld a,(hl) ;%0000efgh ;slowmem
       ld l,c 
;+208 
        pop bc ;4pix + 4pix
       dec h
       or (hl)   ;%abcd0000 ;slowmem 
;+229 =+1 
       ld (de),a ;slowmem (write at +8) 
;+8 
       inc e
       ld l,c
       ld a,(hl) ;%abcd0000 ;slowmem
       inc h
       ld l,b
       or (hl)   ;%0000efgh ;slowmem 
;+40 
       ld (de),a ;slowmem (write at +47) 
;+48 
       pop bc ;4pix + 4pix 
;+58 
       inc e
        nop ;!!!!!!!!!!!!!!!
       ld l,b
       ld a,(hl) ;%0000efgh ;slowmem
       dec h
       ld l,c
       or (hl)   ;%abcd0000 ;slowmem 
;+96 
       ld (de),a ;slowmem (write at +103) 
;+104 
 if PENT
 ds 3
 endif
inc e
 jr nz,mcloop0 ;+120 
;+115 
inc d 
;+119 
   And similarly 3 more lines. Then repeat ─
rumbles.
   Different delays - for different machines (+2/
+3/Pentagon) . ATM consider the Pentagon. 

   As expected, in some pictures
it looks better than naked R-Mode. All the way─
in any case, more vividly. And it still remains
ability to display black and white sprites
on top of the picture.
   Who cares, but it seems to me that at least in pairs
dem this should be used at least for uti─
wounds to the noses of the commodores, who are even na─
There is not enough mint for such a trick :)
   Examples in the application, converter too, is─
walkers too, but I wrote this and moved on to
other projects!

Share your thoughts about the article