Author Topic: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)  (Read 21313 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
Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« 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:
« Last Edit: December 07, 2010, 06:54:27 pm by willrandship »

Ashbad

  • Guest
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #1 on: December 07, 2010, 07:40:10 pm »
interesting

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: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #2 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.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #3 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+.

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: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #4 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

SirCmpwn

  • Guest
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #5 on: December 07, 2010, 08:31:00 pm »
Can someone screen this?

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #6 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.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

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: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #7 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

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: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #8 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. :(
« Last Edit: December 08, 2010, 01:43:09 am by DJ Omnimaga »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #9 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.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #10 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
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

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: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #11 on: December 08, 2010, 03:05:16 pm »
This seems to work, although I wonder what does A do?

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: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #12 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?

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #13 on: December 09, 2010, 01:23:34 pm »
I usually do it like that.
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Axe 8-level (ish :P) Greyscale (With Code Example!!!!)
« Reply #14 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.
« Last Edit: December 10, 2010, 07:03:34 pm by kindermoumoute »
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%