The Quest for the Perfect Palette Generator

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

Joe
Posts: 650
Joined: Mon Apr 01, 2013 11:17 pm

Re: The Quest for the Perfect Palette Generator

Post by Joe »

Drag wrote:If I can dig up the PAL definitions of RGBW and add YUV decoding, I can hypothetically create a PAL palette generator too, but I'd have no way to compare it against a real TV.
The PAL definitions (among many others) are helpfully included in the H.264 specification, annex E, section E.2. Table E-3 contains the RGBW coordinates, table E-4 contains the gamma conversion functions, and table E-5 contains the YUV/RGB transformation coefficients. Of course, you have to know which version of NTSC/PAL you're implementing, since many of those values were redefined over the years... (edit: these may also be helpful.)

I'm kind of surprised you don't already have YUV decoding as an option; most analog (and all digital) NTSC televisions use YUV decoders.
Last edited by Joe on Fri May 30, 2014 11:02 am, edited 1 time in total.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: The Quest for the Perfect Palette Generator

Post by tepples »

I think for solid colors, YUV and YIQ decoding are equivalent.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

Palette generator updated. Now includes the ability to save your palette to a file, hopefully.

Older version with the stuff I removed in the newer version is still available here for ~historical~ purposes. :D
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

After playing around with this a bit, I found that the default settings, but with sat = 0.9, bri = -0.18, and con = 1.18, gives me a palette that's extremely close to my TV, just with less saturation in certain colors (but that's really unavoidable).

I dunno, try it out, this works for me, but may not work for everyone else. :P

You actually don't need to touch the gam setting, it looks like the gamma is somehow correct even without adjusting it.

Edit: Updated again, there was a small bug with the contrast setting.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

Another update.

I found out that one of my older color clipping methods actually matched my TV a lot better than the desaturate setting. I also needed to apply some kind of clipping to the RGB that comes out of the YIQ->RGB equation because having an unbounded positive range is technically incorrect. Either way, with these changes, the setting {darken, -0.25 hue, 0.7 sat, -0.2 bri, 1.2 con, 1.0 gam, fcc} looks nearly identical to my TV, especially since the colors don't wash out now. The best example of this is the SMB title screen, on my TV, the sky is a lot darker than the white text, although much more colorful.

Edit: Just needed one more tweak to the hue setting.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: The Quest for the Perfect Palette Generator

Post by rainwarrior »

Real cool.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: The Quest for the Perfect Palette Generator

Post by tokumaru »

Just wanted to say I appreciate the work you're doing on this! :mrgreen:
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

Thanks guys!

I added another colorimetry option where it's FCC's color primaries and sRGB's white point. This seems to be a closer match for my TV. I'm torn between darken and desaturate; darken preserves the hue, but the relationship between the colors is wonky. desaturate preserves contrast at the expense of lightening certain colors. I guess without any way to literally make the colors more vibrant, this will have to do.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

One last update for tonight, you can toggle the text on and off, and I changed the default parameters to the ones that work best for me personally, just so people don't blindly open up my palette generator and use the godawful baseline parameters thinking it's a good palette. :P

Do RGB monitors (like ones in coin-ops) use similar primaries to the FCC spec, or something different? I was just thinking that I could use the same math to generate RGB palettes, or LUTs for them anyway. Hell, this is even one tweak away from also generating Atari 2600 palettes, hypothetically. :P
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

Just made some UI updates, you can hide the CIE graph if it takes up too much space, and now there are +/- buttons beside the tuning controls.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: The Quest for the Perfect Palette Generator

Post by lidnariq »

Drag wrote:Do RGB monitors (like ones in coin-ops) use similar primaries to the FCC spec, or something different?
Yeah, it's the same phosphors as an ordinary television, so the X,Y should be the same.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

Perfect. Thank you! :D
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

I have a couple of suggestions now:
{-0.25, 0.7, -0.2, 1.2, 1.0} (default settings when you first open the palette generator)
This is very very close to my own TV's output. This is pretty good for just playing games and every day casual use.

{-0.25, 0.8, -0.2, 1.0, 1.0}
This is a slightly darker palette, but represents the colors a lot more faithfully, for instance, I can actually tell what hues the lightest colors are, just like I can with my TV. If you're looking to design some graphics and you really need an accurate representation of the colors and how they contrast against each other, this is what I'd recommend. Even though I said this palette is darker, you don't even notice unless you have something BRIGHT WHITE open next to your emulator.

{0, 0.7, -0.1, 1.1, 1.0}
This is something BMF came up with when he compared against an old 1982 composite monitor. Since said monitor is so old and designed for computers and not for TV signals, you could argue that it follows the FCC standard a bit more strictly, which is evidenced by the fact that a hue adjustment of 0 looked correct.

Finally, I think my TV does some kind of flesh tone boosting. Not only do I need a -0.25 hue tweak to get the colors to look right, a lot of the non-green/blue colors are really warm and reddish.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: The Quest for the Perfect Palette Generator

Post by Drag »

You can now specify a custom colorimetry instead of the four that I put in. Changing the color primaries doesn't appear to be as useful as changing the white point is. I think my TV uses a different white point because gray looks different compared to what gray looks like on my screen here. Specifically, gray on my screen looks bluer than gray on my TV, which looks more yellowy. Using D55 seems to be an improvement, but I don't want to say anything until I actually compare some games. I'm pretty sure the white point varies between TVs because I also have a small Sony Trinitron that is extremely yellow, like warmer than D50.

By the way, changing the white point between D50, D55, D65, and D75 is kinda like changing the color temperature on your monitor.

Edit: I just checked, D55 indeed gives me some stronger reds and better grays that aren't as bluish. Also, in case anyone has no clue what I'm talking about, I'm using the coordinates from here for the white points. C is the standard for the original FCC, D65 is what everyone uses nowadays.
User avatar
*Spitfire_NES*
Posts: 306
Joined: Fri May 21, 2010 4:10 pm

Re: The Quest for the Perfect Palette Generator

Post by *Spitfire_NES* »

This is all very interesting drag! Thanks for everything you have put in.

One question, i tried your settings of:

{-0.25, 0.8, -0.2, 1.0, 1.0}
This is a slightly darker palette, but represents the colors a lot more faithfully, for instance, I can actually tell what hues the lightest colors are, just like I can with my TV. If you're looking to design some graphics and you really need an accurate representation of the colors and how they contrast against each other, this is what I'd recommend. Even though I said this palette is darker, you don't even notice unless you have something BRIGHT WHITE open next to your emulator.

i tried using this palette on my tv, as i play through a console emulator, and was wondering, the saturation seemed perfect to me with this setting, but it was very very dark on the tv. Anything i can try to have some sort of heavy saturation with the darker colors i remember nes having, but in some way be able to be able to have everything a little brighter, it was just a little too dark and some things on the screen were hard to see.

anyways, great work man! :beer:
Post Reply