Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - full screen 2bpp bitmap image

Reply to topic
Author Message
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
full screen 2bpp bitmap image
Post Posted: Thu Oct 26, 2017 1:20 pm
it's since some time this tickles me... a sort of 2bpp (4 colors) bitmap mode (all points addressable 'APA') to show still images exploiting the SMS dual palette system to somehow circumvent the tile limit (you know, you need 768 tiles to fill the screen...)

so I took the famous Lena (or Lenna) image and reduced it to a 768-tile 4 gray levels image (dithered, for best results!) and so split that image into two parts, 384 tiles each, and converted each part using Maxim's BMP2Tile.

at runtime (but one could of course do that before!) I recombine the two parts reusing the same 384 tiles, two bytes from the upper part and two bytes from the lower part for each tile.

carefully crafting the two palettes then I can show either the first or the second content of each tile, hiding completely the other part.

I think the result is pretty good :) (and there's also some free tiles for, say, a few sprites)
Lena_SMS.png (28.48 KB)
screenshot of the output image, tilemap and palettes
Lena_SMS.png
lena.zip (81.45 KB)
source and assets

  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 886
  • Location: Spain
Reply with quote
Post Posted: Thu Oct 26, 2017 1:25 pm
Oh! I want to take a look when I'm at home!
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14734
  • Location: London
Reply with quote
Post Posted: Thu Oct 26, 2017 7:04 pm
On one hand, we only have four greys anyway, but it's still a bit unhelpful for a game. Maybe you could do a Qix variant using this?
  View user's profile Send private message Visit poster's website
  • Joined: 23 Mar 2013
  • Posts: 611
  • Location: Copenhagen, Denmark
Reply with quote
Post Posted: Thu Oct 26, 2017 8:37 pm
Impressive!
  View user's profile Send private message Visit poster's website
  • Joined: 06 Apr 2011
  • Posts: 250
  • Location: Netherlands
Reply with quote
Post Posted: Fri Oct 27, 2017 8:02 am
Creative!
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Oct 27, 2017 8:17 am
Maxim wrote
On one hand, we only have four greys anyway, but it's still a bit unhelpful for a game. Maybe you could do a Qix variant using this?


actually I can't think of any practical use... well, maybe Qix :)

BTW it also supports color, albeit it's very limited... but somehow feasible for images with very few colors, such as this one:
Lambo_SMS.png (17.3 KB)
fullscreen Lamborghini at 2bpp (4 colors)
Lambo_SMS.png
lamborghini.zip (56.44 KB)
(source and assets)

  View user's profile Send private message Visit poster's website
  • Joined: 26 Dec 2004
  • Posts: 374
  • Location: Japan
Reply with quote
Post Posted: Mon Oct 30, 2017 12:35 am
My SMS 3-D demo uses this technique to store about 2 screens' worth of bitmapped graphics. By rearranging the palettes, it can show either of the 2 images alternatingly, or with a blended red/cyan etc. palette for anaglyph 3-D glasses.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Nov 02, 2017 9:31 am
a friend told me that the method isn't clear enough from the posted screenshot, so I hope these new screenshots are better:

@ccovell: a link? :)
Lena (Emulicious).png (38.54 KB)
screenshot on Emulicious (Lena)
Lena (Emulicious).png
Lamborghini (Emulicious).png (33.19 KB)
screenshot on Emulicious (Lamborghini)
Lamborghini (Emulicious).png

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14734
  • Location: London
Reply with quote
Post Posted: Thu Nov 02, 2017 10:02 am
http://www.smspower.org/Homebrew/SMS3DDemo-SMS
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Nov 02, 2017 3:19 pm
Wow, I've never seen that before and it's 12 years old!

BTW it seems to me you're using a single palette (and always less than 448 different tiles) or am I doing something wrong?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14734
  • Location: London
Reply with quote
Post Posted: Thu Nov 02, 2017 4:37 pm
I think it's the same technique applied to nearly fullscreen images to allow a palette swap to select between each half of the image, or a blended value for coloured glasses using a single palette.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Nov 02, 2017 4:47 pm
yeah, in that sense it's true, it's storing two different color for each pixel and it's using palette rewrites to show two different images. I'm instead using two palettes to show a single image, but what mattered to me was to achieve a true fullscreen APA mode. From here to port PC CGA games it's a breeze ;)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14734
  • Location: London
Reply with quote
Post Posted: Thu Nov 02, 2017 4:52 pm
Haha, maybe make a replacement drawing board ROM too?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Nov 03, 2017 9:35 am
Well, don't know... maybe?

The matter here is that for a single set pixel I'll have to read two bytes from VRAM, mask one bit each to remove the previous color, write the new value in those proper bits and write the two bytes back to VRAM. It would probably take some 300+ cycles -interrupt and VRAM safe of course- for a single pixel, which makes the whole thing almost useless.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14734
  • Location: London
Reply with quote
Post Posted: Fri Nov 03, 2017 10:26 am
It's not much different to if you were doing APA any other way except for 1bpp, I think. It's just never going to be fast.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Nov 03, 2017 2:44 pm
APA set-pixel would be useless, but the technique can be anyway interesting for full screen B/W bitmaps, or for images with very few colors
  View user's profile Send private message Visit poster's website
  • Joined: 01 Aug 2012
  • Posts: 322
  • Location: Porto, Portugal
Reply with quote
Post Posted: Tue Dec 26, 2017 9:04 pm
i can’t remember if years ago i shared here some kind of slideshow using similar technique (using 384 tiles as 768, with 4 colours), or if i just tried to code a picture converter using imagemagick from sdlbasic (as i usually do) (i think i tried to use photos shared at http://blog.iso50.com (i hope they wouldn’t mind? :D ) as test, mostly because they look really great as “quadritone”) (i had some idea of using colour palettes like from http://colourlovers.com/palettes/random , obviously using only 4 from those 5 colours, and having those colours “painfully” posterized! :D )
  View user's profile Send private message Visit poster's website
  • Joined: 01 Aug 2012
  • Posts: 322
  • Location: Porto, Portugal
Reply with quote
Post Posted: Tue Dec 26, 2017 9:06 pm
anyway, i wanted to use that for a kind of game, perhaps something like http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs#Walking_aroun...
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Wed Dec 27, 2017 8:54 am
You could use static b/w images and have 'tiled' text under that with little effort, addressing pixels directly would be painfully slow probably.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Aug 2012
  • Posts: 322
  • Location: Porto, Portugal
Reply with quote
Post Posted: Wed Dec 27, 2017 8:24 pm
i can’t remember if i posted this in this forum years ago... - the idea was to use pictures (perhaps compressed, Daniel Bienvenu made an amazing job at AtariAge forum sharing his experiences and compressing/decompressing tools and code on Colecovision) instead of that random testing noise

  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Dec 29, 2017 12:11 pm
I've been doing similar tests these days, but if you want to create a second layer using adjoining sprites you can only do that if the second layer's width is at most 64 pixel - or up to 128 pixel using zoomed sprites -as in the code you posted- which unfortunately means that the image will have half the resolution AND (and that's much worse IMHO) it won't be shown correctly on the SMS' first revision hardware, because of the infamous sprite zoom bug :|

edit: on the Game Gear it's totally doable. Screen width is just 160 pixel, thus 64 pixels is more than a third of that. Also there's not such thing as sprite zoom bug.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3823
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Jan 05, 2018 10:13 am
Last edited by sverx on Fri Jan 05, 2018 1:38 pm; edited 2 times in total
a small example - using sprites to create an upper static layer while doing raster effects on the background

(assets taken from Xeno Crisis Kickstarter page)

edit: no, I'm not porting Xeno Crisis to GameGear
xc.gif (25.86 KB)
Animated GIF (click to run)
xc.gif
XC.zip (3.93 KB)
GameGear ROM

  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 886
  • Location: Spain
Reply with quote
Post Posted: Fri Jan 05, 2018 11:19 am
Wow! I like it!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!