Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: willrandship on December 07, 2010, 06:44:24 pm

Title: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: willrandship on December 07, 2010, 06:44:24 pm
The process is fairly simple:
Have 2 greyscale sprites
One Displays, then the other, in rapid succession.

easy code example:
Code: [Select]
[ffff0000ff00ff00]->Pic1F
[ff00ffff00ff00ff]->Pic1B
[ffffffff00000000]->Pic2F
[ffffff00ffff0000]->Pic2B
ClrDraw
ClrDrawr
repeat getkey(15)
Pt-Off(0,0,Pic1F)
Pt-Off(0,0,Pic1B)r
DispGraphrr
Pt-Off(0,0,Pic2F)
Pt-Off(0,0,Pic2B)r
DispGraphrr
End

It gives a very scanlined Grayscale, but the values go as follows:

(Value, 1st Pic Gray, 2nd Pic Gray, ranging 0-7 and 0-3 respectively)
0,0,0
1,1,0
2,1,1 (2,0 looks the same, but is more flickery)
3,0,3
4,1,2
5,1,3
6,2,3
7,3,3

Simple process. Some optimization (or Asm rewrites for built-in commands, dispgraphrrr anyone? :P) and it could be rather smooth! On my nspire, they're all quite flickery, but I got to try it for a tiny bit on an 83+, and it looked much better. I had not yet tested all the shades, though. :w00t:
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 07, 2010, 07:40:10 pm
interesting
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: willrandship on December 07, 2010, 07:51:12 pm
I'm not sure exactly how close a few (3 and 4, among others) are in shade, since the nspire sucks at greyscale :P

I tried with 4-level and 3-level once (would have had smoother shades) but the timings didn't work out, and it ended up just being solid 3-level.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: shmibs on December 07, 2010, 08:25:59 pm
Quote from: will
since the nspire sucks at greyscale
how DARE they use higher end lcd's?!!

ima try this out soon to see how well it runs on the 84+.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: willrandship on December 07, 2010, 08:26:39 pm
Hey, it's their emu that sucks at not seeing greyscale images and using their hardware-driven stuff. :P
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: SirCmpwn on December 07, 2010, 08:31:00 pm
Can someone screen this?
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: meishe91 on December 07, 2010, 08:45:36 pm
Huh, I couldn't get it to work really on my 84+ :( I checked my code twice but all I'm getting is two solid lines of black, a row of alternating black and gray pixels, two rows of that last row reversed, two rows of gray, and one row of alternating gray and blank pixels ??? So I don't know why it's not working for me :( But seems like a cool idea/program.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: willrandship on December 07, 2010, 08:48:35 pm
Hmm.....Strange. Did you try it with Full? On the Nspire it doesn't do anything, but hey, it might have some effect for the 84+ screens. It sounds like your screen is better than mine :P
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 08, 2010, 01:21:58 am
You should post a 8xp or something, I would like to see how this looks like :D

EDIT: Nvm I just copied it on calc. Seems nice, but if I fill the entire screen with sprites it looks really crappy. It might be ok for games with very few sprites displayed in 15 MHz mode, but it might be unpractical otherwise. :(
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: meishe91 on December 08, 2010, 02:09:56 am
Hmm.....Strange. Did you try it with Full? On the Nspire it doesn't do anything, but hey, it might have some effect for the 84+ screens. It sounds like your screen is better than mine :P

Ya, I tried in 15MHz and 6MHz mode. When in 15MHz mode it has a heavy scan line that goes from top to bottom on the gray parts. 6MHz mode is exactly what I described. I don't know if it's a typo in your code, my code, or something just weird.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 08, 2010, 07:45:56 am
Can you tell me if this code works.
Code: [Select]
[ffff0000ff00ff00]->Pic1F
[ffffffff00000000]
[ff00ffff00ff00ff]->Pic1B
[ffffff00ffff0000]
ClrDraw
ClrDrawr
0=>A
repeat getkey(15)
1-A=>A
Pt-Off(0,0,A*8+Pic1F)
Pt-Off(0,0,A*8+Pic1B)r
DispGraphrr
End
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 08, 2010, 03:05:16 pm
This seems to work, although I wonder what does A do?
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: willrandship on December 08, 2010, 06:08:51 pm
DJ: This was intended to make a few things on the screen higher level (like characters) while the rest is still 4 level.

That appears to be swapping between the two sprites, and optimizing the code, by having a go 1,0,1,0, but why not use not(a->a?

also, does ++ no longer work?
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 09, 2010, 01:23:34 pm
I usually do it like that.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 10, 2010, 06:57:38 pm
An exemple of code to see 8 level grayscales :
Code: [Select]
:.GRAY8
:[0000000000000000→Pic1
:[FFFFFFFFFFFFFFFF]
:0→A→B→C
:Repeat getKey(15)
:sub(GR)
:DispGraph<sup>r</sup><sup>r</sup>
:End
:Return
:
:Lbl GR
:ClrDraw
:ClrDraw<sup>r</sup>
:1-C→C
:For(Y,0,7)
:For(X,0,11)
:If X+1^2+C
:If 1-A→A
:1-B→B
:End
:End
:Pt-Off(X*8,Y*8,B*8+Pic1)
:Pt-Off(X*8,Y*8,A*8+Pic1)<sup>r</sup>
:End
:End
Top left, there is in order:
black and black, black and gray 75%, gray 75% and gray 25%, gray 75% and white, gray 25% and black, gray 25% and gray 75%, white and gray 25%, white and white.
B change buffer and A back-buffer. C alternates between two screens imaginary.

Actually there is only 7 grayscale (gray 75% and gray 25% = gray 25% and gray 75%).

EDIT : Woa, it work perfectly with full mode.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 10, 2010, 07:08:10 pm
Woah that looks great! I wonder how it looks like on-calc... is the blinking very visible?
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 10, 2010, 07:13:35 pm
An exemple of code to see 8 level grayscales :
Code: [Select]
:.GRAY8
:[0000000000000000→Pic1
:[FFFFFFFFFFFFFFFF]
:0→A→B→C
:Repeat getKey(15)
:sub(GR)
:DispGraph<sup>r</sup><sup>r</sup>
:End
:Return
:
:Lbl GR
:ClrDraw
:ClrDraw<sup>r</sup>
:1-C→C
:For(Y,0,7)
:For(X,0,11)
:If X+1^2+C
:If 1-A→A
:1-B→B
:End
:End
:Pt-Off(X*8,Y*8,B*8+Pic1)
:Pt-Off(X*8,Y*8,A*8+Pic1)<sup>r</sup>
:End
:End
Top left, there is in order:
black and black, black and gray 75%, gray 75% and gray 25%, gray 75% and white, gray 25% and black, gray 25% and gray 75%, white and gray 25%, white and white.
B change buffer and A back-buffer. C alternates between two screens imaginary.

Actually there is only 7 grayscale (gray 75% and gray 25% = gray 25% and gray 75%).

EDIT : Woa, it work perfectly with full mode.

sick man!

and I think there really is a difference between those tow, just very slight, so yeah it is 8 level :)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 10, 2010, 07:16:42 pm
Woah that looks great! I wonder how it looks like on-calc... is the blinking very visible?
Correct on 83+.

And now, 16 grayscales  >:D

Here a gif with wabbitemu :
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: c.sprinkle on December 10, 2010, 07:17:10 pm
That screenshot looks nice.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 10, 2010, 07:17:25 pm
Woah that looks great! I wonder how it looks like on-calc... is the blinking very visible?
Correct on 83+.

And now, 16 grayscales  >:D


the cake is a lie!
/me wonders what 32 color looks like...

edit: and c.sprinkle I see you are now on omnimaga too from cemetech!  welcome! :D
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 10, 2010, 07:22:09 pm
Limit is.... 144 grayscales  :banghead:

EDIT : approximately.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Yeong on December 10, 2010, 07:23:30 pm
woot 144 greyscales...
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: c.sprinkle on December 10, 2010, 07:24:32 pm
That looks pretty cool.
Ashbad:
Chances are if nobody's posting on Cemetech, someone is here and vice versa. That way I can always have someone to discuss programs with.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 10, 2010, 07:25:59 pm
holy shit...

your gray scale routine in pure axe is the best I've ever seen...
/me hands kindermoumoute the Nobel prize for politics
 (http://www.cybernations.net/images/lovetoo.gif)

c.sprinkle: I figure the same, though I check cemetech 30% of time and omnimaga 70% of time
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 10, 2010, 07:29:27 pm
holy shit...

your gray scale routine in pure axe is the best I've ever seen...
/me hands kindermoumoute the Nobel prize for politics
 (http://www.cybernations.net/images/lovetoo.gif)

c.sprinkle: I figure the same, though I check cemetech 30% of time and omnimaga 70% of time

An entire evening making head to look for this algorithm instead of revising my courses. :love:
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: c.sprinkle on December 10, 2010, 07:31:03 pm
I suppose that means you spend a lot of time posting???
:)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 10, 2010, 07:32:24 pm
That looks pretty cool.
Ashbad:
Chances are if nobody's posting on Cemetech, someone is here and vice versa. That way I can always have someone to discuss programs with.
Heya welcome on Omnimaga! And yeah I agree that both forums got plenty of calculator fans to discuss with plus plenty of varied discussions. I hope you enjoy your stay in the community. :)

Limit is.... 144 grayscales  :banghead:

EDIT : approximately.
O.O

I really need to try on calc, though. I wonder if it would be practical to use 16 level inside a game in 15 Mhz mode? Sprites might become pretty large in size.

I think I'll dig up my TI-83 Plus Silver Edition and see how it looks like later. :)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Yeong on December 10, 2010, 07:33:13 pm
so...if you implement this on games, will it slow down a game a lot?
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: c.sprinkle on December 10, 2010, 07:35:44 pm
Yeah, probably. The grayscale support for three and four- color is pretty fast, but higher is slowing down by a noticeable amount.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: guy6020665 on December 10, 2010, 07:36:36 pm
Holy!!!! :o  O.O 144 shades!?!?!? That's  :crazy:  Good job man :thumbsup: I wonder if this has even been done before with pure ASM.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Runer112 on December 10, 2010, 11:51:59 pm
A main reason why not much more than 4-level grayscale has been done before is because the screen driver is so slow. Even if a program theoretically uses a high level of grayscale, the screen and driver are physically incapable of producing much more than a somewhat solid-looking 8-level grayscale.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 11, 2010, 12:50:23 am
True. This is also why we need to interlace grayscale like this (the scanlines). Without the scanlines, it would blink like mad, even in 3 or 4 level grayscale. That's how crappy the LCD driver is. I tried xLIB 3 level grayscale once and even though it involves BASIC code, I still had to slow the grayscale updating down to keep it somewhat synced with the LCD and preventing it from looking horrible.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 11, 2010, 07:53:30 am
Other funny stuff : random grayscales.
(http://img4.hostingpics.net/pics/167902Randomgrayscale.gif)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 11, 2010, 07:57:55 am
^ that would be a beastly special effect in a game.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Munchor on December 11, 2010, 08:00:00 am
That looks very good kinder!
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 11, 2010, 07:13:55 pm
I have revised my calcul: in fact all the screens shown above was displaying no more than 7 levels of gray!

In Axe Parser, the screen can display 4 grayscale from 0% (white), 33%, 66% and 100% (black).
When we alternate on the screen 2 imaginary memory screens, we obtain 7 levels of gray : 0%+0%=0%, 0%+33%=16,5%, etc.

That is exactly what we find here :
(http://img718.imageshack.us/img718/6526/8grayon84full.gif)
(the 3rd and 6th tile are identical)

Then when we add a third screen in memory, we get 10 levels of gray : 0%+0%+0%=0%, 0%+0%+33%=11%, etc.
That's what we have here :
(http://img219.imageshack.us/img219/6958/wabbitemu.gif)
(hard to discern, but they are all here)

So on : with a 4th screen we get 13 levels of color. Briefly, it is far from the 144 levels of gray.

From 10 grayscale screen flashes.

For your eyes I've made a screen composed of 13 levels of gray, I don't see them all, but they are there.. :D
(http://img841.imageshack.us/img841/2201/13grayscales.gif)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 13, 2010, 12:19:26 am
I have revised my calcul: in fact all the screens shown above was displaying no more than 7 levels of gray!

In Axe Parser, the screen can display 4 grayscale from 0% (white), 33%, 66% and 100% (black).
When we alternate on the screen 2 imaginary memory screens, we obtain 7 levels of gray : 0%+0%=0%, 0%+33%=16,5%, etc.

That is exactly what we find here :
(http://img718.imageshack.us/img718/6526/8grayon84full.gif)
(the 3rd and 6th tile are identical)

Then when we add a third screen in memory, we get 10 levels of gray : 0%+0%+0%=0%, 0%+0%+33%=11%, etc.
That's what we have here :
(http://img219.imageshack.us/img219/6958/wabbitemu.gif)
(hard to discern, but they are all here)

So on : with a 4th screen we get 13 levels of color. Briefly, it is far from the 144 levels of gray.

From 10 grayscale screen flashes.

For your eyes I've made a screen composed of 13 levels of gray, I don't see them all, but they are there.. :D
(http://img841.imageshack.us/img841/2201/13grayscales.gif)
Great stuff!

I wish on-calc 8 level grayscale flickered less than WabbitEmu, because it would be epic to have in game. :D
Other funny stuff : random grayscales.
(http://img4.hostingpics.net/pics/167902Randomgrayscale.gif)
That looks great too, but when you create animated screenshots, when you start gif capture, you should wait at least 8 hours before running the program into the screenshot. :P

http://ourl.ca/6245
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 13, 2010, 05:00:02 pm
Sorry, first time I do it. :D
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 13, 2010, 05:08:13 pm
No problem, I was being sarcastic in reference to how, 6 months ago, people waited extremly long in their screenshot to actually start the program then people had to wait 2-3 minutes before something cool happens. :P
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: c.sprinkle on December 13, 2010, 05:14:18 pm
That is pretty cool. I wish you could speed the calc up so this would be useable.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 13, 2010, 05:16:01 pm
well, when sped up, it is still pretty flickery -- while it is not the fastest way to do 8 level (a faster way is possible in asm where you create scan lines and send the result directly to the lcd)

^that method I just mentioned can be almost flickerless, ALMOST.  But 4 level can be pretty perfect if you do it right :)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: ztrumpet on December 13, 2010, 06:06:26 pm
Looks nice Kinder. :)

I wonder if calc84 would write an 8 level greyscale Axiom...  ;D
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 14, 2010, 03:28:55 am
^ That would rule. I don't know if I would use it much, though, because on the regular 83+ you can only see about 6 shades of gray. :( (contrast is too sparse)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: TIfanx1999 on December 14, 2010, 05:57:46 am
^What DJ said. 8 is doable, but some of the shades are not very distinguishable from one another on calc. =(
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: willrandship on December 14, 2010, 09:41:04 am
Well, 7 is just about what I could get on my nspire, with the code I posted at the top. kindermoute, how did you get it to run that fast with the screen full of sprites?  O.O
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: kindermoumoute on December 14, 2010, 11:59:20 am
Ok, if i've time, i'll post commented code.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 14, 2010, 11:15:07 pm
^What DJ said. 8 is doable, but some of the shades are not very distinguishable from one another on calc. =(
Well it depends. On the 83+SE and the 84+ it looks pretty fine. It's just on the old 83+ that it looks crappy.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: TIfanx1999 on December 15, 2010, 04:16:03 am
Ah, when I had Ti1plea's 8 level demo on my 83+ SE, it looked ok, but some of the lighter shades were really hard to see and a some of the dark ones looked similar. In my case, it actually looked better on my regular 83+ BE. Go figure, Ti with there crappy inconsistent LCDs...
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 15, 2010, 04:17:08 am
Strange, I guess my old 83+ has a crappier LCD. But again, if you got an even older 83+ it might be why on yours it looked better.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: TIfanx1999 on December 15, 2010, 04:19:02 am
I got it second hand so I have no idea. I just wish their product quality levels were more consistent. :/
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 15, 2010, 04:21:28 am
Me too. It makes it impossible to have the same grayscale quality on all calc. Everyone has to test and the programmer has to calibrate. I think most people gave up on that and now try to make grayscale just look good enough instead of nearly perfect.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: matthias1992 on December 18, 2010, 05:30:26 pm
*bump* probaly I jsut have a crappy LCD but if I set the program on the end of page 1 to Full it doesn't work in the sense that it displays all kinds of garbage all over the freaking place. I did run ALCDFIX before trying, same result.

Any clue on why this happens?
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: FinaleTI on December 18, 2010, 05:34:12 pm
*bump* probaly I jsut have a crappy LCD but if I set the program on the end of page 1 to Full it doesn't work in the sense that it displays all kinds of garbage all over the freaking place. I did run ALCDFIX before trying, same result.

Any clue on why this happens?
Does it set it to Normal right before DispGraphrr?
Because the DispGraphr and DispGraphrr only work in 6Mhz mode. You could have the code set Normal right before the DispGraphrr and Full right after, though.
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: Ashbad on December 18, 2010, 05:51:24 pm
Me too. It makes it impossible to have the same grayscale quality on all calc. Everyone has to test and the programmer has to calibrate. I think most people gave up on that and now try to make grayscale just look good enough instead of nearly perfect.

I figured out how to combat the poor 4 level gray display on the 83+ -- by using 8 level gray :D

basically, all you have to do is change the 4 level routine to 8 level display, but still only read from 2 buffers.  Then for the two grays, you pick the two colors closest to 50% gray, and it should work fine and  look fantastic, but a bit more flickery :)
Title: Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
Post by: DJ Omnimaga on December 18, 2010, 07:44:10 pm
You mean you just flash those additional levels of gray? I think Calc84maniac actually just used more spaced scanlines actually. In calc84's case, I think it takes 3 sprites.