Author Topic: Full-color backgrounds  (Read 1726 times)

hcf

  • Jr. Member
  • **
  • Posts: 93
Full-color backgrounds
« on: April 26, 2010, 05:13:29 AM »
I am going to post here something that I have been working on. In case someone is interested and/or wants more information, let me know.

During my (short) life as an amateur PCE developer, when I programmed non-srolling games, I used to draw 16-color backgrounds (and invoke them with the infamous load_background method). But after many time I was thinking... "the PC Engine can manage 16 background palettes, and each palette can manage 16 colors... so why THE F*CK I am only using 16 colors in my backgrounds?".

So, I have tested methods to split a picture in several fragments, and use a different 16-color palette in each fragment. If we divide the screen in 16 sections, we can have a theoretical limit of 256 background colors on screen (16 palettes x 16 colors each one). I tried several methods to split the background image (by rows, by columns...) but my primary methods did not give good results, as there were nasty effects in the limits of every row or column. But finally I have seen that splitting the image by SQUARES, and converting each square to 16 colors, gives very decent results.

I tried to apply this in one of my past games (my old Vampire Story Demo) and here are the results: for example, in the third background the differences are clear. In the two backgrounds of the left, the differences are not as good. Also, I have seen that this methods is usefull in realistic backgrounds (like these ones) but not in cartoon-like backgrounds.


Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #1 on: April 26, 2010, 05:31:24 AM »
looks nice!

did you end up writing a utility to handle the splitting, or did you just wing it by hand?
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #2 on: April 26, 2010, 06:24:35 AM »
hehe cool hcf, i 'am also working on a converter, who's using multiple palettes (all 16 in fact) ..

And i have also an idea to show 512 colors pics on screen ..
 :clap: to you ..

How many colors contain this pictures exactly ???
« Last Edit: April 26, 2010, 06:27:15 AM by touko »

hcf

  • Jr. Member
  • **
  • Posts: 93
Re: Full-color backgrounds
« Reply #3 on: April 26, 2010, 06:27:26 AM »
In fact I was writing that application... but then I saw that it exists yet!! It is ImageMagick, it's free, and it's awesome because it can do first all the split and then transform to PCX format. The bad thing is that it is 256-color PCX, so finally I must open all those PCX fragments with another program and convert them to 16-color PCX, but it is worth the time (maybe 10 minutes, and I have converted all the backgrounds of the game). If you decide to use Imagemagick, I can help you because I have fought versus that program a bit yet  :D

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21371
Re: Full-color backgrounds
« Reply #4 on: April 26, 2010, 06:42:22 AM »
Well done; that's a pretty big improvement.  8)

How many colors did each pic end up having after subtracting the inevitable duplicates?
U.S. Collection: 98% complete    157/161 titles

hcf

  • Jr. Member
  • **
  • Posts: 93
Re: Full-color backgrounds
« Reply #5 on: April 26, 2010, 08:14:00 AM »
My previous response was directed to Arkhan. Touko, I didn't read your post when I was writing mine, because we were writing almost at the same time  :mrgreen:

So, the application that I said that exists yet (ImageMagick) is the one that says Arkhan (a program that splits the image and converts it to 16 PCX images). I was not talking about the application that Touko is making, that obviously DOESN'T exist yet. By the way, Touko, I would love to see your results when you finish it!! And... these 512 colors are 256 in background and 256 in sprites, or are you preparing us another surprise?  =P~

As far as the number of colors that Necro and Touko asked for, tomorrow I will try to get a program to count them. I have tried to analize the JPG that I have uploaded, but it seems that the JPG format has changed a bit the image, so it is not totally reliable. I hope to tell you tomorrow how many colors are using those enhanced backgrounds, as Necro is right: some of the palettes repeat colors, so the total is not 256 at all... but I hope that it's much more than 16.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #6 on: April 26, 2010, 08:18:27 AM »
In fact I was writing that application... but then I saw that it exists yet!! It is ImageMagick, it's free, and it's awesome because it can do first all the split and then transform to PCX format. The bad thing is that it is 256-color PCX, so finally I must open all those PCX fragments with another program and convert them to 16-color PCX, but it is worth the time (maybe 10 minutes, and I have converted all the backgrounds of the game). If you decide to use Imagemagick, I can help you because I have fought versus that program a bit yet  :D
Yes i know imagemagic ..
For multiple conversions you can use Xnview will convert you all your pcx at time.
« Last Edit: April 26, 2010, 09:32:30 AM by touko »

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #7 on: April 26, 2010, 08:42:41 AM »
If you have Paint Shop Pro, it counts the colors!

I tried to do it but the uploaded pic is a jpeg, so that didn't work as planned.


Ill have to give image magick a shot, since I am very retarded at image-work.  :) lol
« Last Edit: April 26, 2010, 08:47:29 AM by Arkhan »
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

hcf

  • Jr. Member
  • **
  • Posts: 93
Re: Full-color backgrounds
« Reply #8 on: April 28, 2010, 04:09:34 AM »
It's strange... I am not able to count the colors used. I executed the demo with Mednafen, and I captured the screenshot (Print Page key). I pasted it in several programs (Paint, Photoshop, Ultimate Paint...) but the number of colors allways is enormous ( >1,000 ). And I try to count the colors before saving the picture!! (in order to prevent errors in the conversion). Anyone has used a method to count colors in a PCE game, with good results? Maybe the output of Mednafen is not exact, and I must use another emulator?

In any case, I would like to post here another thing that I have been thinking of: besides the limitation of the number of colors that we can use (which is the point that I am trying to solve now) we must keep in mind that we have another limitation: the total spectrum of colors in the PC Engine is 512. See the following example:



The first picture is the original, the second is the conversion to 16 colors, and the third uses my method (16 palettes of 16 colors, by squares). You can see in the face of the kid that the increment between adjacent colors is very high, whereas in the original picture it is very smooth. The reason, in my opinion, is that the PC Engine does not have colors in the middle of the ones that is using. In other words: the number of "blue" colors that we have is limited, so even if we can choose 256 different colors, there is not a high amount of "usefull" colors for each image.

In this sample, we can see that our method gives better results than using only 16 colors, but we are very far of that theoretical limit of 256.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #9 on: April 28, 2010, 05:11:52 AM »
sometimes its better to just use 16 colors and dither it, to get a similar shading effect.


especially for human skin, and stuff like you posted.    16 colors, dithered properly, ends up looking as good as if you use many palettes.


as for color counts, count the colors BEFORE you emulate?

Otherwise, there is a screenshot button in mednafen, that saves images, I think it is F9.

That will give better screen dumps than Print Screen key
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #10 on: April 28, 2010, 07:24:59 AM »
Yes this is normal with your technique, you cannot have 256 colors on screen ..

max 80/96 colors ..

Vecanti

  • Hero Member
  • *****
  • Posts: 629
Re: Full-color backgrounds
« Reply #11 on: April 28, 2010, 08:57:59 AM »
Here are some images I had.  They are all converted to 9bit (512 possible colors)

The first are 16 colors (out of 512)  the second set are 256 (out of 512).  The 256 I didn't do using the 16 color separate section technique, but I might give it a try. I'd think the results would be somewhere in between the 2 below.

16 out of 512


256 out of 512

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #12 on: April 28, 2010, 12:31:45 PM »
Yes this is normal with your technique, you cannot have 256 colors on screen ..

max 80/96 colors ..

You can have 256 colors on screen for the background.

16 palletes * 16 colors = 256.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

nodtveidt

  • Guest
Re: Full-color backgrounds
« Reply #13 on: April 28, 2010, 02:20:40 PM »
The actual number is 15 * 16 + 1. 15 unique colors per palette, plus one common color. That comes out to 241, which is your max color count for tiles alone. 242 if you count overscan, but that's not really even a consideration if you're only using tile memory.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #14 on: April 28, 2010, 02:35:27 PM »
oh, yeah, that damn common color that I always frigging forget about because im a retard.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.