linear and gamma rgb output?

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
Posts: 1
Joined: Sat Feb 02, 2019 8:33 am

linear and gamma rgb output?

Post by shoobean » Sat Feb 02, 2019 9:19 am

Hi, This subject confuses me.

I keep reading that the color output from emulators should be converted from gamma space to linear space. But the rgb colors written out by emulators look like linear values to me.

higan sameboy, bgb:
gameboy = 00, 55, ~AA, FF
gameboy color = +8 steps if no lcd color correction used

snes and megadrive emulators look linear steps to me also (240p test suite grey ramps, uncorrected rgb screenshots)

I'm aiming for blending correct-ness with scale-type filters and shaders.

The other part that puzzles me is the colorspace part. {0, 85, 170, 255} should be converted to PC srgb values? Why do emulators not seem to have this step in their source code or final capture screenshots? It acts like 1:1 passthrough.

But I don't know. Thanks for helping.

Posts: 9794
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: linear and gamma rgb output?

Post by lidnariq » Sat Feb 02, 2019 11:10 am

Any emulator for a console that originally targeted a CRT TV can take advantage of the CRT and modern display having a comparable gamma, typically 2.2. (Some OSes have different defaults. I think Apple's OS uses a gamma of 1.8, so emulators on Apple hardware might explicitly want compensation )

The colors on a Game Boy, in contrast, appear to be different amounts of linear brightness. (Well, darkness, but.) So "proper" colors shouldn't be linearly spaced in the 2.2 gamma of your display, but instead cluster up towards "bright".

Also the Game Boy's contrast ratio isn't amazing—10:1 at best, possibly as bad as 3:1—nor do emulators usually emulate its pixels' very slow response. With only four shades, this isn't usually very important. (Noticeable exception: at least one game uses flicker to get 7 shades of grey, and this is a stroboscopic nightmare in many emulators)

The Game Boy Color display, on the other hand, has a very extreme gamma—maybe around 0.25?—and many of the brightest colors "bleed" into adjacent subpixels, producing dramatic chroma error. This differing gamma is at least part of what "LCD color correction" means. Nocash (or Pan?) wrote:
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.

Finally, you're noticing that many emulators are just plain sloppy about this.

Post Reply