Hello NES developers
I have a question related to NES palette colours
https://www.google.com.eg/search?hl=ar& ... i6nFo8M%3A
I know that each colour is of 6 bits ( 2 bits -> red , 2 bits -> green and 2 bits-> blue)
I want to write a software concerning the pattern tables, attributes ...etc , my question is how the 24 bits of the color codes (the rgb we use ) are mapped to only 6 bits ?
I mean if I have the 6 bits of the NES colours , how to know their 24 bit-equivalent colour ? what operations to do ?
Thank's in advance
NES palette
Moderator: Moderators
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: NES palette
The NES colours are not made of RGB components. It's more like 2 bits for intensity, and 4 bits for hue.Muhammad_R4 wrote:I know that each colour is of 6 bits ( 2 bits -> red , 2 bits -> green and 2 bits-> blue)
Most emulators just use a palette table to map the NES colours to RGB colours for the output system.Muhammad_R4 wrote:I mean if I have the 6 bits of the NES colours , how to know their 24 bit-equivalent colour ? what operations to do ?
Here's an example generator to make that kind of palette: http://bisqwit.iki.fi/utils/nespalette.php
More accurate emulation will try to simulate the effects of NTSC signal generation, which are a lot more complicated than just mapping to a single RGB colour.
Example: http://slack.net/~ant/libs/ntsc.html
-
- Posts: 66
- Joined: Sat Jun 25, 2016 5:33 am
Re: NES palette
that's good, now how they map the 2 and the 4 bits to an RGB 24 bit color code ?Most emulators just use a palette table to map the NES colours to RGB colours for the output system.
Re: NES palette
They don't map to RGB color codes at all.
They generate a square wave of NTSC signal that goes up and down between a high and low voltage level, and the phase of the wave determines the hue.
There's an article for this on the Nesdev Wiki, which has more information than you ever wanted to know about how NTSC TVs work.
A couple of random illustrations from the wiki:
So if you want to do all the complicated calculations of converting to the YIQ color space, then to YUV, then finally getting RGB out of that, that's fine. Or you could build of someone else's work. Nintendulator has a very nice NES palette.
If you want to generate NTSC composite video directly, you can make the same square wave patterns that the NES does.
They generate a square wave of NTSC signal that goes up and down between a high and low voltage level, and the phase of the wave determines the hue.
There's an article for this on the Nesdev Wiki, which has more information than you ever wanted to know about how NTSC TVs work.
A couple of random illustrations from the wiki:
Code: Select all
1.0 +--+
0.9 | |
0.8 | |
0.7 +--+ | +-+ +-+
0.6 | | | | | |
0.5 | | | | | |
0.4 +--+ | | | | |
0.3 +--+ | | | | |
0.2 | | | | | |
0.1 | | | | | |
0.0 . +--+ . . . . . +-+ +-+ + . .
-0.1 --+
0D 0F 2D 00 10 30 11
So if you want to do all the complicated calculations of converting to the YIQ color space, then to YUV, then finally getting RGB out of that, that's fine. Or you could build of someone else's work. Nintendulator has a very nice NES palette.
If you want to generate NTSC composite video directly, you can make the same square wave patterns that the NES does.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: NES palette
That's actually the Master System palette.Muhammad_R4 wrote:I know that each colour is of 6 bits ( 2 bits -> red , 2 bits -> green and 2 bits-> blue)
The NES palette is notoriously hard to convert to RGB, because there are a lot of steps in between, and the final result never pleases everyone, because each person had a different TV that rendered the colors differently, so they have different memories of what the NES palette looks like.
Other consoles also suffered from all the processing that happened to the colors until they reached people's eyes, but since many of them used RGB internally, it's hard to argue with that...
Re: NES palette
I took the liberty of running Bisqwit's tool to make something that looks fairly realistic.
Default parameters were used, except saturation at 1.2 and gamma at 2.0
The RGB PPUs (2C03, 2C04, and 2C05) have three 3-bit DACs and an internal lookup table from 6-bit palette values to 3-bit-per-channel RGB. These are also ripped, and they can be used without modification if you want a Genesis game's palette to match that of a PlayChoice, Famicom Titler, or the "garish" mode of the NESRGB.
Default parameters were used, except saturation at 1.2 and gamma at 2.0
The RGB PPUs (2C03, 2C04, and 2C05) have three 3-bit DACs and an internal lookup table from 6-bit palette values to 3-bit-per-channel RGB. These are also ripped, and they can be used without modification if you want a Genesis game's palette to match that of a PlayChoice, Famicom Titler, or the "garish" mode of the NESRGB.