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

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #15 on: April 28, 2010, 07:52:42 PM »


You can have 256 colors on screen for the background.

16 palletes * 16 colors = 256.

Yes in theorie, but with hcf 's method is clearly impossible ..

Only way possible is to make tiles with your hands.

« Last Edit: April 29, 2010, 08:12:59 AM by touko »

hcf

  • Jr. Member
  • **
  • Posts: 93
Re: Full-color backgrounds
« Reply #16 on: April 28, 2010, 11:51:44 PM »
In fact, using all the 256 different colors (or 241) is not realistic. As Necro said, in almost every picture there are repeated colors. It is very difficult to split an image in 16 sections, using a different palette in each section, and achieve that every section uses 16 DIFFERENT colors. It's very easy that some colors are repeated between different sections.

As far as the "common color", now I am astonished. Why is my method working? I convert the original picture to 16 different pictures of 16 colors, but I am not ensuring in any way that all the palettes have a common color. It's strange... I guess that the common color is the first of every palette, that is the "transparent" color, isn't it? As far as I know, the transparent color in tiles IS displayed (whereas in sprites it is not displayed).

Hehehe, Touko, I have seen that in this thread we are allways posting almost at the same time  :mrgreen:

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #17 on: April 29, 2010, 05:11:00 AM »
Don't wory about color 0, all colors 0 of each palette are ignored and only color 0 of the first palette is displayed ..

Hehehe, Touko, I have seen that in this thread we are allways posting almost at the same time  :mrgreen:

yes, it's my 6th sense  :^o
 :P
« Last Edit: April 29, 2010, 05:15:36 AM by touko »

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #18 on: April 29, 2010, 05:36:41 AM »
color 0 is the common color between all palettes.

Every palette should start with that color.


While it isn't really realistic to get 256 unique colors unless you do a rainbowy pattern, you can still refer to it as "256 color" because say you use pink up in the top tile, along with some blues.

and then you need to the pink down in the bottom, with a buncha reds....!

You HAVE to duplicate colors sometimes :)
[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.

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: Full-color backgrounds
« Reply #19 on: April 29, 2010, 10:17:27 AM »
So call me curious. Assuming we have 241 colors (bg reserved), what would be a good way of doing the color-matching for a picture? Obviously, we are gonna get dismal results if we just chop the colors to 3 bits a piece. So, if we count the actual colors, and assign the most frequently used to seperate palettes, then split the image up, would that help ? And what would I have to do if I decided to dither things ?

I know I have a -very- limited choice of colors, but I think dithering would help there. Unfortunately, I don't now that much about matching colors, or what would be considered a 'good' match via dithering.

I was gonna try to write one of these converters using allegro, but couldn't think of a good general-purpose way to do it. Anyone have any suggestions?

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #20 on: April 29, 2010, 10:24:36 AM »
I'll talk to you about it in a few hours when I show up at your house. :D


but the short version of it is, there are some dithering styles already present that I can show, that might help
[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.

Vecanti

  • Hero Member
  • *****
  • Posts: 629
Re: Full-color backgrounds
« Reply #21 on: April 29, 2010, 10:46:04 AM »
So call me curious. Assuming we have 241 colors (bg reserved), what would be a good way of doing the color-matching for a picture? Obviously, we are gonna get dismal results if we just chop the colors to 3 bits a piece. So, if we count the actual colors, and assign the most frequently used to seperate palettes, then split the image up, would that help ? And what would I have to do if I decided to dither things ?

I know I have a -very- limited choice of colors, but I think dithering would help there. Unfortunately, I don't now that much about matching colors, or what would be considered a 'good' match via dithering.

I was gonna try to write one of these converters using allegro, but couldn't think of a good general-purpose way to do it. Anyone have any suggestions?


What are the tile sizes 8x8?   I could see where you have an image and the top is mostly blue say 200 x 40 pixels.  Optimially you would use 1 or 2 pallets for that whole section and then you have 14 or 15 pallets left for a much smaller section of the screen.  You could do some pretty good optimization, you're right it's just figuring out how to calculate it and implement it.


Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #22 on: April 29, 2010, 10:48:28 AM »
it will be tricky to implement well I think, since most of it is kind of on the fly when you do it by hand.

There may be color optimization algorithms floating around out there already.
http://en.wikipedia.org/wiki/Dither

There are some traditional dithering methods.

I like Sierra the most.
[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 #23 on: April 29, 2010, 08:38:12 PM »
In fact I tested to do Dithering too, but I didn't get good results. I must try that Sierra method...

It's important to keep in mind that "my" method is not an alternative to dither: my method and dithering have diferent goals and you can use both methods. My method simply splits the original image in 16 sections and converts each section to 16 colors. At this time (when you convert images to 16 colors) you can use dithering or not. I tested it, and I get some good results but also some bad results. Now I'm going to post here one example of a bad result when dithering:



The first two images where made using two methods of dithering (FloydSteinberg and Riemersma) and the third does not use dithering. In the two images with ditheirng, the result is a bit fuzzy and IN MY OPINION does not give any positive points, and the image without dithering is very clear. But this is only my opinion, and maybe someone can like more the results with dithering. Also, I have get other examples where dithering gives good results. Besides, dithering seems very very good if you see the image from a far distance, but this is not our case  :wink:

@TheOldMan: that application for conversion would be interesting, although there are some programs that do image conversions yet. Maybe you would like to test them before starting to do that program on your own.  In fact, almost every image program can convert a picture to few colors (for example, to 16 colors or 256 colors). I have used the free Ultimate Paint, and it converts to 16-color PCX well (don't forget to check the "Transparent" checkbox if you are making sprites). Also, it has another checkbox for "dither", although it doesn't have several dithering methods, it only has one). Of course ImageMagick can convert and dither too (the fragments of the images of above were converted with ImageMagick).

In case that you are still interested in making that program, well... in fact the idea that you proposed is one of the main methods to make color reduction (counting the frequency of every color). At this point, the key is choose which are the representative colors. If you search in Google for "Color reduction" you will find lots of these methods.

@GobanToba: Yes!! If there is a big part of the image where you can use only one palette, then you will have the other 15 palettes for the rest of the picture. In this case, you will probably have to do the split manually. The method that I proposed in my first post was an automatic way to do it (dividing the image in 16 square sections) but of course the results can be enhanced with your idea.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Full-color backgrounds
« Reply #24 on: April 29, 2010, 09:00:45 PM »
Here are some 16 color, sierra dithered images.





Also, the Doom image in my MML test video, is 16 colors, Sierra dithered, and you see it turned out nice.

[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 #25 on: April 29, 2010, 09:14:53 PM »
The best way i think, is to make yourself a converter.

I dont like dither, pics seems to be dirty.

hcf

  • Jr. Member
  • **
  • Posts: 93
Re: Full-color backgrounds
« Reply #26 on: April 29, 2010, 10:03:24 PM »
Mmm, Sierra method looks nice!! But I think that there are cases where dither gives good results, and other cases where results are not as good, but it is just my opinion. For example, in the sample that you posted of "Shadow of the beast" I don't like dithering, I think like Touko: the picture appears to be dirty. But for example, the picture of the mountain is beautifull!!!  :D   In general, I am not using dither in my conversions, but maybe it is better to do the two options in every picture, and choose the best.

By the way, which program did you use to make that Sierra algorithm? And... what does your "change of avatar" mean?  :wink:

Hey Touko, you did not post at the same time of me today. Were you sleeping?  :mrgreen:

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #27 on: April 29, 2010, 10:08:57 PM »
Hey Touko, you did not post at the same time of me today. Were you sleeping?  :mrgreen:

Lol, yes a little bit ..

Some parts in rtype pic are good, like spaceship, but for the 2 other pics, i dislike ..
In my opinion, dither must be applied to several parts of pictures, not entirely.
« Last Edit: April 29, 2010, 10:14:11 PM by touko »

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: Full-color backgrounds
« Reply #28 on: April 30, 2010, 02:43:09 AM »
I understand there are image programs that do the conversions, but I haven't found one yet that will take into account the palette limits of the pce. The goal of writing a converter program would be to maximize the number
of useable colors on screen (ie, tile palettes would have minimal duplicated colors).
So, if we have a high-color (256+) image, which we convert to the pce's 3/3/3 color range, we could then choose
the most frequently used 241 colors as a basis for the palettes; we would probably have to dither the image at this point to minimize the loss of detail.
Then comes the tricky part: we would have to divide the screen (and probably the palettes as well) into sections, ordering them by actual # colors required in that area. That way, we can allocate more sub-palettes to areas with lots of different colors. Then we go throught the sub-areas, and build the palettes to (attempt to) minimize duplicate colors in each sub-palette....

I'm not sure it would be the optimal solution; I think you're still going to end up with lots of duplicated colors among the palettes. I do think it could be done, though probably not very fast. And almost certainly not as well as if you hand-tuned the colors. I'll have to think a lot more about it, but maybe someday I'll actually try this.
I always want to know how things like that work :-)

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Full-color backgrounds
« Reply #29 on: April 30, 2010, 03:43:01 AM »
Fragmare has made a good utilities for converting a 256 colors bmp picture in pce format (with 16 palettes) .

Actually i'am coding my own ..
« Last Edit: April 30, 2010, 04:02:34 AM by touko »