Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: Hot_Dog on May 17, 2010, 01:32:34 pm
-
I don't think I'll end up using flickerless grayscale, but what's the idea behind it? I'm used to the idea of flicker, so I'm curious as to how flickerless is accomplished on the Ti-83+.
-
Let me use the 3 level grayscale example.
For example you got the following sprite:
BBBBBBBB
BBBBBBBB
BBBBBBBB
GGGGGGGG
GGGGGGGG
GGGGGGGG
WWWWWWWW
WWWWWWWW
B=black, G=gray, W=white. For the Gs you would quickly swap them back and forth from white to black. However, because the 83+ LCD is not memory-mapped, flickering will occur. However, what we generally do is make the G part a checkered pattern that is inverted rapidly. An optical illusion will cause our eyes to not notice as much flicker. The flicker will happen, but you'll see some sort of checkered gray pattern that doesn't seems to flicker as much instead, even if each pixel really flickers as much.
For 4 level grayscale, instead of checkered patterns some sort of scanlines needs to be used, and in ASM there's another method involving interlacing
Here's an example screenshot attachment of 3 level grayscale with the LCD blurring eliminated completly
-
Making DJ text a little more visual, alternating
10101010
and
01010101
produces greyish to our eyes if is alternated fast enough.
EDIT: DJ shows a screen shot...
For 4 level grayscale the patterns used are:
.db %11111111
.db %11111111
.db %00000000
.db %11111111
or
.db %11011011
.db %10110110
.db %01101101
.db %11011011
The first looks better, I think, with scrolling. The second with more still images.
-
Actually, the 4 level grayscale is this pattern:
11011010
10110101
01101011
11010110
10101101
01011011
10110110
01101101
In the one you posted, there are the same number of 0s as 1s in the 3rd and 6th columns making those pixels medium gray instead of dark gray. This pattern can also be inverted bitwise for light gray.
-
I just shamelessly copied of James Montelongo graylib2.inc.
Wow, I can now see how the scanlines are done. :o
Interleaving can be used in assembly to easily access the dark and light layer of 8 pixels quickly before copying to the LCD. It achieves better speed but you have to change your sprites routines and data.
-
In any case, never use vertical or horizontal scanlines for grayscale. Firetrack2 by Benryves does the former, and the flicker is really noticeable.
-
The idea with interlacing is that in 1 byte you can show 75% of the data from the dark layer, and 25% of the light layer at the same time. So instead of showing 1 layer then the other, you can mix them into the same LCD update, which helps reduce flicker.
-
The idea with interlacing is that in 1 byte you can show 75% of the data from the dark layer, and 25% of the light layer at the same time. So instead of showing 1 layer then the other, you can mix them into the same LCD update, which helps reduce flicker.
OMG, i never fully understood that before, but when you explain it that way it's crystal clear! Thanks tr1p1ea! :D
-
Really? for the grayscale in the games I've made, I always use 3/8 on for light gray (37.5%) and 5/8 for dark gray (62.5%). Do other 4 level grayscale games use 1/4 and 3/4 for gray levels? How would these be interwoven?
I would think it would have to be something like this for best results:
11101110
10111011
11011101
01110111
It seems hard to create this kind of cycle though.
-
the xLIB method in BASIC is
11011011
10110110
01101101
11011011
10110110
01101101
11011011
10110110
for light gray it is
10010010
00100100
01001001
10010010
00100100
01001001
10010010
00100100
However, this takes more space since each layers are hard-coded into sprite/tiles data and if you have several plain gray tiles in a row in a map, the scanlines might look a little weird
-
No, it's really supposed to be 1/3 and 2/3. I don't know where people are getting the /4 and /8 from.
-
I think one of the basic grayscale tutorial used 1/4, 2/4 and 3/4, for 5 level grayscale. For the 2/4 it was a normal 3 level gs checkered pattern
-
I think one of the basic grayscale tutorial used 1/4, 2/4 and 3/4, for 5 level grayscale. For the 2/4 it was a normal 3 level gs checkered pattern
Makes sense.
-
what i find as a very annoying dilemma is that with one byte, you can have up to 9 level grayscale:
00000000
00000001
00010001
00100101
01010101
11011010
11101110
11111110
11111111
If you wanted to conserve space and keep one pixel in 3 bits, i.e., 8 pixels in 3 bytes, you have to leave one of the levels out...so, which one?
-
At best, its a 15MHz z80 processor, there is only so much you can push the limits, man. I admire your resolve, though.
-
Mhmm interesting, it would be nice to see some more experiments with multiple levels of grayscale
-
what about during self-test, when it goes through those different patterns on the screen? unless my eyes deceive me, there is that weird thing where it phases from dots to horizontal lines. i don't know about you, but that looks actually flickerless grey to me. (unless the contrast is down then?)
-
it isn't grayscale, it's the contrast being down in some cases or the crappy calc LCD causing contrast to go down when there are alternate rows of pixels turned on/off (which probably uses a lot of power for odd reasons. It's 10x worse on the regular 83+)
http://ourl.ca/2774
-
DJ, I think that happens on all the calcs. I notice it a lot on my 84+se. =/
-
I personally never noticed it much on my 83+SE. It happened, but to a much lesser extent.