Author Topic: [TUTO] 7 level interrupt grayscale in Axe  (Read 5133 times)

0 Members and 1 Guest are viewing this topic.

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
[TUTO] 7 level interrupt grayscale in Axe
« on: May 21, 2013, 10:17:49 am »
Well, I came up with a way to do 7 level (although not completely flicker-less) grayscale in Axe.

I used Hayleia's interrupt method for getting that nearly perfect refresh rate!

Here's the source:

Code: [Select]
:.PIC8
:
:FnOff
:
:ClrDraw{^r}{^r}
:
:[FFFFFFFFFFFFFFFF]→Pic1
:
:0→T
:
:det(768,0)→C
:
:det(768,0)→B
:
:det(768,0)→A
:
:For(Y,0,7)
:Pt-On(8,Y*8,Pic1,C)
:Pt-On(32,Y*8,Pic1,C)
:Pt-On(48,Y*8,Pic1,C)
:Pt-On(16,Y*8,Pic1,B)
:Pt-On(40,Y*8,Pic1,B)
:Pt-On(48,Y*8,Pic1,B)
:Pt-On(24,Y*8,Pic1,A)
:Pt-On(32,Y*8,Pic1,A)
:Pt-On(40,Y*8,Pic1,A)
:Pt-On(48,Y*8,Pic1,A)
:End
:
:FnInt(D,0)
:
:While 1
:EndIf getKey(15)
:LnReg {^r}
:Return
:
:Lbl D
:!If (T++^5)
:DispGraph(A,C){^r}{^r}
:DispGraph(B,A){^r}{^r}
:End
:Return

Do you see the secret? It's buffers! Instead of using the default buffers, I created 3 buffers that have different weights. They go as follows:
none: 0/6
C: 1/6
B: 2/6
A: 3/6

You can not repeat buffers, but you can add them up to get all values 0-6 out of 6

The key in the code is this section (the only one I will explain)

Code: [Select]
:Lbl D
:!If (T++^5)
:DispGraph(A,C){^r}{^r}
:DispGraph(B,A){^r}{^r}
:End
:Return

The front buffer gets a weight of 2/6, and the back, 1/6. Add up the totals, and you get A=3, B=2, and C=1!

So long as you get those totals, it doesn't matter how you display the graph (within the interrupt or not) (which makes it less flickery, but more inconsistent)

That's it! Pretty simple, eh?

Good luck, and may the grayscale be with you!
« Last Edit: May 21, 2013, 11:40:10 am by pimathbrainiac »
I am Bach.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #1 on: May 21, 2013, 11:38:11 am »
It's seem great !
But....
One thing to said :
just don't use this :

Code: [Select]
!If (T++^10)

remove the parenthesis because they are useless...
and you should precise that you have to change the value after ^ (or not) to find the perfect greyscale lvl of one calc (It's just test, though)
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #2 on: May 21, 2013, 11:39:55 am »
It's seem great !
But....
One thing to said :
just don't use this :

Code: [Select]
!If (T++^10)

remove the parenthesis because they are useless...
and you should precise that you have to change the value after ^ (or not) to find the perfect greyscale lvl of one calc (It's just test, though)

That's true.

Also: it should be T++^5. Editing the post
I am Bach.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #3 on: May 21, 2013, 08:05:09 pm »
Tht's pretty awesome, 7 level greyscale! :D
* Sorunome expects games >:D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Ki1o

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 119
  • Rating: +5/-2
  • Doing my best...
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #4 on: May 21, 2013, 08:08:28 pm »
Screenies?  :P

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #5 on: May 21, 2013, 08:39:09 pm »
Not quite yet. I think I may have the right stuffs now to make nearly thepenguin77 good 8 level.

(hint hint: masking)
I am Bach.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #6 on: June 01, 2013, 01:36:33 pm »
That is great :D
That could be useful for games where there is not a lot of movement.

And glad my method could be of any use :)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #7 on: June 06, 2013, 06:57:36 pm »
Well, wabbit doesn't like programs meant to show new grayscale techniques, but here's a screenie:
I am Bach.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #8 on: June 07, 2013, 01:11:31 am »
Well, wabbit doesn't like programs meant to show new grayscale techniques, but here's a screenie:
It may depend on your settings. Sometimes using "Steady Freq" with well chosen frequence and number of shades make grey look perfect on Wabbitemu.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #9 on: June 07, 2013, 02:25:37 pm »
Wabbitemu's grayscale often gives the best result when it's set to the number of shades you want to show, or when it's set to a multiple of that.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [TUTO] 7 level interrupt grayscale in Axe
« Reply #10 on: June 07, 2013, 05:46:08 pm »
Yeah, just play around with wabbits settings and you can get the greyscale to look perfectly :)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!