Author Topic: How to make 6 through 8 level grayscale  (Read 3119 times)

0 Members and 1 Guest are viewing this topic.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
How to make 6 through 8 level grayscale
« on: January 06, 2012, 08:56:35 pm »
Hi,
I know the routine for 3,4, and 5 level grayscale but I was wondering how to make 6,7, and 8 level, and maybe even 16...
When I say routine I mean as in this:

1 is black, 2 is white
3-lvl

10101     
01010
and
01010
10101

4-lvl
light gray:
100
010
001
and
010
001
100
and
001
100
010
dark gray is same as light gray but inverted


So how do I make 6 lvl, 7 lvl, and 8 lvl grayscale? Maybe even 16...

Thanks,
nxtboy III

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 to make 6 through 8 level grayscale
« Reply #1 on: January 06, 2012, 11:13:56 pm »
For 16, use an nspire. It has hardware support for it :P

By the way, the entire concept of "levels" in greyscale doesn't need a pattern, they just reduce the flicker you percieve in the image. For 8 level you need 7 in the cycle: (this is a pattern for one pixel, checkerboarding is still a good idea) (0)0000000, (1)1000000, (2)1000100, (3)1001010, (4)1010101, (5)1101101, (6)1110111, (7)1111111

That's just an example. You want to have the 1s and 0s as well interspersed in the pattern as possible, AND you want the pictures being drawn at 60 FPS! Are you doing this in Asm? Axe won't do it so well, since (unless I missed something in a recent update) it doesn't have timings fast enough for anything greyscale.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: How to make 6 through 8 level grayscale
« Reply #2 on: January 06, 2012, 11:18:25 pm »
Thanks for the help! So I just shift each one over 1 pixel for checkerboard?

Actually, 16 level gray is possible on TI 84. I have seen it on ticalc and ran it on my calculator. It is awesome.

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: How to make 6 through 8 level grayscale
« Reply #3 on: January 06, 2012, 11:23:01 pm »
I've seen some grey scale in axe and I think it looks fine :)
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

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 to make 6 through 8 level grayscale
« Reply #4 on: January 09, 2012, 07:20:36 pm »
Yeah, but that's using the built-in functions that actually handle it with optimized asm code. doing it in axe code means it will be slower.

Also, remember that you increase the size of any graphics in your game every time you add more levels. 4-level takes 2 sprites for one picture, 8 takes 7, etc. it takes more and more work to make and more space in your program.

Also, I'd love to see the 16-level grey program. Not doubting it exists, but I want to see how much other stuff there is in the game itself. Just a demo makes it significantly easier, especially if you can hardcode the loading of just one image, rather than any method of multi-picture rendering (which any game needs if it's not text based)