Author Topic: How does 4-level greyscale work in Axe?  (Read 26413 times)

0 Members and 1 Guest are viewing this topic.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
How does 4-level greyscale work in Axe?
« on: June 04, 2010, 02:44:55 pm »
I've been trying to wrap my head around it, but the documentation doesn't mention much. I can do 3-level fine, manually, but do dispgraphr and dispgraphrr work? Cross-hatching patterns, Evolving backgrounds? I'm so confused!

Any help on this?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #1 on: June 04, 2010, 02:51:47 pm »
That's the technical details. You only need to concern yourself with how you use it.
For greyscale, both the buffer and back-buffer contain data used for drawing to the screen.
For 3-level:
00 - white
01 - grey
1x - black
For 4-level:
00 - white
01 - light grey
10 - dark grey
11 - black
where the first bit is what's present in the buffer and the second for what's in the back-buffer.
Cross-hatching and evolving backgrounds refer to the techniques to reduce flicker.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #2 on: June 04, 2010, 02:53:24 pm »
Aaah, so One sprite gets written to the backbuffer, one to front?
That makes a little more sense.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #3 on: June 04, 2010, 02:57:10 pm »
yeah, where each sprite contains part of the data, as shown above.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: How does 4-level greyscale work in Axe?
« Reply #4 on: June 04, 2010, 05:34:33 pm »
The method Axe uses for grayscale is nice because it makes it much easier to create sprites. Making xLIB/Celtic III grayscale sprites is a major PITA because you need to draw each interlaced frames manually or using an app by Nitacku x.x

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #5 on: June 04, 2010, 07:19:58 pm »
Manual interlacing sounds awful and editing them sounds even worse...
Thankfully, Axe does this automatically. :)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: How does 4-level greyscale work in Axe?
« Reply #6 on: June 04, 2010, 07:23:37 pm »
it is. Just a tile with the first two rows of 8 pixels black, the next two dark gray, the next two light gray and the rest white took 5 minutes to draw x.x. It's trial and error. Now imagine with tree sprites, for example. Nitacku program helps a lot for that. It does the job for you. THe only issue is that sprites takes more space than in ASM since it uses 3 or 4 layers instead of 2

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #7 on: June 05, 2010, 04:32:55 pm »
So, now Im having another issue.

When I try 4-level grey I see a checkerboard-ish pattern. It happens on my nspire and my sis's 84+.

Here's the code:
.GREY
DiagnosticOff
SetUpEditor
ClrDraw
ClrDrawr
[FFFFFF000000FFFF]->Pic1
[FFFFFFFFFFFF0000]->Pic2
0->G
For(G,1,500)
Pt-Off(0,0,Pic2)r
Pt-Off(0,0,Pic1)
dispGraphrr
end

I'm expecting:
Black Bar
Light Grey Bar
Dark Grey Bar

and I get them, but there is a distinct checkerboarding that doesn't occur when I do 3-level. Any help here?

_player1537

  • Guest
Re: How does 4-level greyscale work in Axe?
« Reply #8 on: June 05, 2010, 04:37:51 pm »
move the pt-offs before the loop, that should fix it

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #9 on: June 05, 2010, 07:15:26 pm »
Also, the 4-level grayscale routine itself was kind of slow.  I have changed that now for the next update and also the 3 level routine so they are much faster and better looking than before.  I even managed to get 3 color gameboy gray (completely flickerless) with more than a few things happening at once.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: How does 4-level greyscale work in Axe?
« Reply #10 on: June 05, 2010, 07:19:12 pm »
wow nice :D

Will they still require 6 MHz mode when ran?

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #11 on: June 05, 2010, 07:25:06 pm »
Absolutely.  Also, the 4 level is more convenient since you no longer use the "Setup" command, it is automatically initialized if it detects it has not yet been initialized just like the 3 level.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: How does 4-level greyscale work in Axe?
« Reply #12 on: June 05, 2010, 07:27:16 pm »
Oooh nice, seems better this way, because I forsee people forgetting to add the setup command in the future x.x

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: How does 4-level greyscale work in Axe?
« Reply #13 on: June 05, 2010, 08:20:38 pm »
Well, I put the for( after the pt-offs, but I'm still getting the checkerboarding. I also tried pt-on instead, but it looks exactly the same. It does flicker less though, so it seems it's running faster.

If it helps, here's the source file.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: How does 4-level greyscale work in Axe?
« Reply #14 on: June 05, 2010, 08:57:02 pm »
the only way to reduce the checkerboard effect is to maybe add a Pause command after the grayscale or add more Dispgraphrr after the one you got to change the speed at which the grayscale is updated. Pause 9 through Pause 12 usually works. Keep in mind this can slow down your game a bit, though.