gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > How to faithfully reproduce GBC/GBA colors?

#178019 - Armadillomon - Sat Jul 20, 2013 2:02 am

Hello!
I have written a program that dumps maps from Pokemon Gold/Silver to PNG files and it works fine, but the colors are not quite like on the Game Boy. For example the reds seem to be more pink. I upscale the r, g and b components by the factor of 33/4, but multiplying by 8 gives almost the same result. How can I achieve more realistic colors? There must be a way, because VBA and BGB get them right (or at least, MUCH better).

I suppose I will encounter the same problem on GBA, so the question applies to GBA also.

#178020 - Dwedit - Sat Jul 20, 2013 2:23 am

Nocash's Pan Docs say something about this:
Quote:

RGB Translation by CGBs

When developing graphics on PCs, note that the RGB values will have different appearance on CGB displays as on VGA monitors:
The highest intensity will produce Light Gray color rather than White. The intensities are not linear; the values 10h-1Fh will all appear very bright, while medium and darker colors are ranged at 00h-0Fh.
The CGB display will mix colors quite oddly, increasing intensity of only one R,G,B color will also influence the other two R,G,B colors.
For example, a color setting of 03EFh (Blue=0, Green=1Fh, Red=0Fh) will appear as Neon Green on VGA displays, but on the CGB it'll produce a decently washed out Yellow.

RGB Translation by GBAs
Even though GBA is described to be compatible to CGB games, most CGB games are completely unplayable on GBAs because most colors are invisible (black). Of course, colors such like Black and White will appear the same on both CGB and GBA, but medium intensities are arranged completely different.
Intensities in range 00h..0Fh are invisible/black (unless eventually under best sunlight circumstances, and when gazing at the screen under obscure viewing angles), unfortunately, these intensities are regulary used by most existing CGB games for medium and darker colors.
Newer CGB games may avoid this effect by changing palette data when detecting GBA hardware. A relative simple method would be using the formula GBA=CGB/2+10h for each R,G,B intensity, probably the result won't be perfect, and (once colors became visible) it may turn out that the color mixing is different also, anyways, it'd be still ways better than no conversion.
Asides, this translation method should have been VERY easy to implement in GBA hardware directly, even though Nintendo obviously failed to do so. How did they say, This seal is your assurance for excellence in workmanship and so on?


The key is that it says that it's non-linear. So you'd need to build a lookup table mapping intensities 0-31 to their 0-255 range. And make something where the first 16 levels vary up to a bright color, then the next 16 levels slowly approach full intensity.

With GBA games though, the NDS lite, and Game Boy Player will display them as true linear RGB values, while the GBA and GBA SP are somewhat washed out. The NDS is better than the GBA SP, but not as good as the NDS lite.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."