A SNES palette questions/inquiry (possibly silly questions)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

A SNES palette questions/inquiry (possibly silly questions)

Post by caramelpuffpuff »

http://wayofthepixel.net/index.php?topic=5118.0

http://nintendoage.com/forum/messagevie ... adid=67596

And a lot of site of palette that kept saying SNES palette is 15 bit that can be found on Wikipedia.


The palettes you linked are shown/used here: https://en.wikipedia.org/wiki/List_of_m ... B_palettes

The SNES, from a software perspective, is 15-bit RGB -- 5 bits for R, G, and B separately. The above wiki page states this clearly and I can confirm it does support that.

These values define the "range of colours" the console supports, not necessary simultaneously (it's probably possible but only with some custom scanline-based hacks/code and I'm not completely sure).

So if you're trying to display a raw 15-bit picture on the SNES, that's not going to be possible without a lot of familiarity with the console.

The closest you'll be able to get is mode 3, which supports up to 256 colours ("indexes") on a single background (BG0) and an additional 16 colours on a second background (BG1). For now just focus on one background (BG0). A colour or "index" is defined by a 15-bit RGB definition (5 bits per R, G, and B).

So on-screen you can have 256 different colours, but the *range* of each of those colours varies depending on what you choose for the R/G/B values.

Make sense now?

It's very similar to the IBM PC's classic VGA mode (320x200x256, a.k.a. segment 0xA000) -- think old MS-DOS games -- except the PC supported 18-bit colour (6 bits per R/G/B), but still with a 256-colour limitation.

(and me, blah, blah, blah..)

I'm saying you can display up to 256 unique colours in mode 3 on a single background. (Mode 3 only offers two BGs -- BG0 = 256 colours, BG1 = 16 colours).

Of those 256 unique colours, you can define the R/G/B values for all 256. The bitdepth of each colour is 15-bit (5 bits per R, G, and B).

Think of it like this, in programming speak:

Code:
palette[0] = rgb(0,0,0); // black
palette[1] = rgb(r,g,b);
palette[2] = rgb(a,b,c);
...
palette[254] = rgb(d,e,f);
palette[255] = rgb(g,h,i);


Hence: 256 colours (256 palette entries), but the "range" of colour each palette entry has is 15-bit (5 bits for red, 5 bits for green, 5 bits for blue).

This is not a "per-game" or "per cartridge" setting -- the SNES lets you use different video modes (called "modes") that support different capabilities. The one with the most colours that you can use the easiest is mode 3.

Those "chart pictures" you have can't be displayed on the SNES because of what I just described above. :-)

I think maybe you should post your question on the SNESdev board...

Okay, I understand what he said, but...I'll be honest, when it comes to questions, I tend to repeat the questions with small changes until I finally figured it out, and I am still little nervous about asking questions publicly, so, here.

I have visit many sites to find the SNES palette, and the only answers I saw was http://en.wikipedia.org/wiki/List_of_mo ... 15-bit_RGB (The 15-bit monochrome and RGB Palette) I gaved up and accept it, so I was using it for a while, but I noticed differences on there.

There is color #70d030 , a type of grassy green from a game, so I went on GIMP to see if this color can be in there, so I did the Select-By-Color tool, and no results is shown at all. On other colors selected, it's just shown AROUND it. (I mean, it selected 20 colors...I know it's part of program, but I did the color-picker tool, and no color is exact to the colors from SNES snapshot on it

...I felt like it could've been 18-bit, but I asked my friend and he saided it's 15-bit...and a lot more he mentioned on the quote above.

I keep having feeling 256 is the REAL limit of SNES usable color, and then it shows here http://img.photobucket.com/albums/v455/ ... fstuff.png , which is the editor for SNES color, which shown to be 496. (Well....I think there's repetitive colors as I see it again..)

I know, the Wiki (Don't always believe anything on Wiki.) says "has a 15-bit RGB (32,768 colors) palette, with up to 256 simultaneous colors." but still, I can't get the feeling if it's 256 colors FROM the color chart, (like "you can only choose up to 256 colors from the system capacities of colors") or it's a HANDICAPPED palette, that it CANNOT show any colors from 32,768 colors, only selected 256 colors, or something.

Here's my questions (that I feel I'll receive negative response) :

-If it IS limited to 256 colors, not 32,768, then what is the REAL palette of SNES colors?

-If they are equal colors, like the system IS capable to full 32.7k sprites, then does it mean that the system "shows the little different" colors to the "chart pictures", like the NES palette difference where brown is colored red in a selected emulator/system (http://www.chrismcovell.com/images/Fami ... erence.jpg if your wondering.), or it's something else?

-Just wondering, if it were limited, how did they pull higher color differences? Did they use "mode" or layers to make it colored "dark/bright" to make it different?

*If anyone is wondering, it does matter, because I feel a lot comfortable if I use the colors EXACT from SNES, it's in my mental feeling where using SNES colors would comfort and calm me a lot. I don't feel like it if it was not SNES colors...You know what I mean?*
Last edited by caramelpuffpuff on Wed Dec 04, 2013 7:11 pm, edited 1 time in total.
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by tepples »

Using GIMP? Try converting your image to RGB, posterizing to 32 levels per channel, and optionally converting back. That'll give you 15-bit color, because 32 = 2^5, and 5 bits per channel * 3 channels (red, green, and blue) = 15 bits.

Which emulator gave you the value #70d030? That sounds like it'd be possible from an emulator that uses #F8F8F8 as white, where the color would be specified as RGB(14, 26, 6) in Super NES or Nintendo DS source code.
User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by caramelpuffpuff »

tepples wrote:Using GIMP? Try converting your image to RGB, posterizing to 32 levels per channel, and optionally converting back. That'll give you 15-bit color, because 32 = 2^5, and 5 bits per channel * 3 channels (red, green, and blue) = 15 bits.

Which emulator gave you the value #70d030?
Uhh.... :?: It was already set to RGB..do I go on Mode+Assign Color Profile..."?

ZSNES V1.36 WIN version?

VIP Mario 5 : From this:
image7.png
image7.png (25.61 KiB) Viewed 15928 times
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: A SNES palette questions/inquiry (possibly silly questio

Post by koitsu »

Just for readers: the large quote in the initial post is from a private conversation caramelpuffpuff and I were having, and I am comfortable with that conversation being disclosed publicly.

The part that, I believe, caramelpuffpuff is having trouble understanding -- and it's very hard for me to rephrase it to make sense to someone -- is what the term "colours" really represents here.

Using mode 3 as an example: you have two backgrounds available, one which supports up to 256 colours (i.e. 256 entries in a palette), and another which supports only 16.

Of those 256 colours (256 palette entries), each colour/entry is a 15-bit value -- 5 bits of green, 5 bits of red, and 5 bits of blue.

The "colour chart" on Wikipedia is showing what the total range of usable colour is on the SNES, i.e. what all those R/G/B combinations are and what they look like -- not how many colours can be shown simultaneously** on the screen at one time.

Wording/phrasing this is very hard given language barriers and so on. If someone here who speaks fluent Spanish (I know there's many of you) can explain the concept of palettes vs. colour depth in Spanish, I'd be grateful.

** -- Except for cases where some programmer has gotten clever and maybe manipulated the PPU per-scanline and is somehow changing palettes/etc. on-the-fly to exceed the limitation set forth by mode 3. But this is an extremely advanced technique and is not "normal" in the sense of "this is easy for a beginner to do".
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Shiru »

SNES has R5G5B5 palette, which is 32768 unique colors. How many of these is possible to display at once is a different matter, normally up to 256, but it could be less in some (most) modes, or more (with tricks), but it does not change the main palette.

ZSNES is one of the least accurate SNES emulators.
User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by caramelpuffpuff »

koitsu wrote:Just for readers: the large quote in the initial post is from a private conversation caramelpuffpuff and I were having, and I am comfortable with that conversation being disclosed publicly.
Sorry. :oops:
Shiru wrote:SNES has R5G5B5 palette, which is 32768 unique colors. How many of these is possible to display at once is a different matter, normally up to 256, but it could be less in some (most) modes, or more (with tricks), but it does not change the main palette.

ZSNES is one of the least accurate SNES emulators.
O_O.....So, the "chart pictures from Wikipedia" is the MOST accurate colors for SNES? and 256 is actually how many it CAN SHOW on the screen?

And I know off topic, but what is the most accurate SNES emulators?
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by tepples »

The most accurate Super NES emulator is bsnes, part of higan. I will warn you that it doesn't run anywhere near full speed on old (pre-Core) or severely battery-constrained (Atom) processors.

It should be possible to increase the number of displayable colors using color math.

And as I suspected, the screenshot you posted uses #F8F8F8 as white, confirming my suspicion of RGB(14, 26, 6).
User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by caramelpuffpuff »

tepples wrote:The most accurate Super NES emulator is bsnes, part of higan. I will warn you that it doesn't run anywhere near full speed on old (pre-Core) or severely battery-constrained (Atom) architectures.

It should be possible to increase the number of displayable colors using color math.

And as I suspected, the screenshot you posted uses #F8F8F8 as white, confirming my suspicion of RGB(14, 26, 6).
O-kaaay? But simple question: color chart pictures 15 bit RBG from wiki = SNES color capacity? Or no?
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Shiru »

Simple answer is yes.

However, TV settings and color encoding can affect this; TV artifacts could create extra 'ghost' colors. This is not related to SNES hardware, it is just what a TV does for every console.
User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by caramelpuffpuff »

Shiru wrote:Simple answer is yes.

However, TV settings and color encoding can affect this; TV artifacts could create extra 'ghost' colors. This is not related to SNES hardware, it is just what a TV does for every console.
OH, THANK, CAKE-ING, GOODNESS!!! THANK YOU SO MUCH!!! :D :D :D :D :D I LOVE YOU!!! ...^^; :oops: :mrgreen: It finally makes sense to me now!

*And a little interest with "ghost" colors*
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Shiru »

Best example of ghost colors is the 'artifacting' on Atari 8-bit range computers. Google for 'atari artifacting' for details, there are plenty articles on this.

On the SNES there is pseudo high res mode (512 pixels horizonally, instead of 256) that interpolates colors of two adjanced pixels. This is hardware feature of the SNES. However, TV itself can create such effect for images that has high X resolution, colors of adjanced pixels blends and looks like some other color.
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by blargg »

Even without artifacts non-linear mappings mean that one 15-bit RGB color space doesn't necessarily match another 15-bit RGB color space, and that each can represent colors that the other can't do accurately. E.g. if one used a straight linear mapping to brightness, while the other used one where more of the range represented more subtle variations in the dark end, while less of the upper range represented the brighter shades with less precision.
User avatar
whicker
Posts: 228
Joined: Sun Dec 13, 2009 11:37 am
Location: Wisconsin

Re: A SNES palette questions/inquiry (possibly silly questio

Post by whicker »

Hopefully this isn't too confusing.

I remember ZSNES not actually using 15-bit color.
I think the new renderer uses 16-bit color (R5 G6 B5) at some stage, before it gets converted to whatever is needed by the display surface.

The back and forth hue shift between adjacent gradient colors in F-Zero gets to be irritating, for me anyways. All due to that extra green bit ZSNES somehow uses.


I also remember byuu obsessing about the proper way to scale RGB555 to RGB888 so that the brightest value was 255 (#FFFFFF), not 248 (#F8F8F8).
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by blargg »

Increasing resolution from x bits to x+n bits is just scaling by (2^n)*(1+1/(2^x)), that is, (orig<<n)+(orig>>(x-n)). So for 5 to 8 bits, you get 00000000, 00001000 ... 00011000, 00100001 ... 11011110, 11100111, 11101111, 11110111, 11111111. There is an error of +/-1/16 step, which is eliminated by just shifting left when n<x.
User avatar
TmEE
Posts: 960
Joined: Wed Feb 13, 2008 9:10 am
Location: Norway (50 and 60Hz compatible :P)
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by TmEE »

255 / 31 = 8.2258...

0,8,16,25,33,41,49,58, 66,74,82,90,99,107,115,123, 132,140,148,156,165,173,181,189, 197,206,214,222,230,239,247,255

Good enough...
Post Reply